Making java executable as a service in solaris10 - Solaris 11

Hi all,
I have written a set of class files and have put them in a jar file.
now i would like to execute that jar file as a service in solris 10.
can you please give all possible ways for this.
i know how to make method script when using SMF facility..
thanks in advance
RaghuDeep Amilineni 

You use the "java" command to execute java programs.
So just make the action of the script "java X.jar". 

Does the OS know the notion of "service", or is it an imported term from Windows?
http://en.wikipedia.org/wiki/Daemon_(computer_software)
On the other hand:
http://oreilly.com/pub/a/sysadmin/2006/04/13/using-solaris-smf.html
Edited by: BIJ001 on 2008.12.15. 14:00 

thank you 

As a Solaris/OpenSolaris-specific tip, an executable JAR file can be run directly--the operating system recognizes JARs and knows to invoke the Java virtual machine to run them. You can use "chmod +x jar_file" to set the executable bit, or use the file browser to do so.

Related

Launching a Jar file under Linux

Hi,
I'm interested in writing a launch script for .jar files so that the user can just execute it to run the jar file. The problem is, how do determine where the Java Runtime has been installed in the target system. If neither PATH nor JAVA_HOME variables are declared. It seems that netbeans auto magically determines the available JREs. How do I achieve the same effect? 
write a .sh file like the following:
PATH_TO_JAVA_BIN_DIR/java -jar MyApp.jarfor example :
/opt/java1.4/bin/java -jar MyApp.jar 
But the, how do I determine,
PATH_TO_JAVAautomatically? I think Netbeans installer does that. 
On Linux you can use the 'which' command:
which java
-Puce 
Which would work only if the "java" command is available in PATH. If it is not there, it would fail. 
Hi again,
take a look at these links to properly configure Java in Unix/Linux OS
http://www.yolinux.com/TUTORIALS/LinuxTutorialTomcat.html#JAVAJDK
http://docs.hp.com/en/5991-5855/ar01s04.html
Basically, you'll need to export some system variables :
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
Doing so, you'll can easily use java and javac commands 
Thanx. But I was just thinking it would be very intuitive if the script is able detect the location automatically.

Can you execute a class file without invoking the command line java command

I am running java on a Windows XP equipped machine, and I am wondering if it is possible to execute a class file by double clicking the file icon, or can it only be done via command line. So far I have been unsuccessful in my attempts - I tried associating the class file with the java executable in my JRE directory, but that didn't work.
Many thanks,
-Stile 
nope, can't be done, by design... microsoft recognised java as threat to the empire very early on in the peace.... but you can write a batch file to execute myprogram.class called myprogram.bat and stick it in your PATH.
keith. 
You can make an executable jar file. 
captain... how do you do that? 
captain... how do you do that?http://java.sun.com/docs/books/tutorial/deployment/jar/
Most IDE's can do it, though. 
http://www.google.com/search?hl=en&q=executable+jar+file&btnG=Search

is it possible to make quick launch icon for a java program?

greetings all
first of all:please recommend me a simple program to convert from jar to exe
and second:is there's an installer that make the java program statup at system tray
meaning make a quick launch icon for it?if there is not,please tell me how to make my java program startup at system tray
thanks in advance 
For making an exe, you can try this:
http://jsmooth.sourceforge.net/index.php
Also, this site shows you how to set a tray icon:
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/ 
hi again Shane_P
i already know how to make a system tray
but i just wanted to know if there's an installer which make my program run at startup
i know the startup folder issue but iam asking about an installer for the user?
thanks 
You can create a bat file to launch your program. 
Make a batch file in your Windows folder called "winstart.bat" you system will run what you have in it. 
thanks all
one part is now solved
ther part is :
now i have three parts
.exe file,lib Folder,.bat file
and i want to make an installation package that install the .exe,lib folder into program files
and run the .bat file to register the program in startup?is this possible first?
if so?which installer should i use?
thanks for your time? 
You need either an exe or a bat file. You do not need both. 
sorry,i can't get it
i meant with the exe file my application that doesn't run on startup by default
and the bat file makes my program run at startup,
and i want my program to run at startup,so i guess i need both of them?
so what do you mean by need only one of them?please give me some explanation,iam beginner
and simply i want to make setup package that installs the jar file,lib folder to program files
and make the program run at startup!what installer should i use? 
Do you know how to execute your program from the command line? Well if you place that command into a .bat file, it will run your program. You do not need a .exe file. 
aha i got it
and what about the setup package,i want to make a setup package that run the .bat file
and put the .exe file,lib folder into program files,which software can do this? 
any help here? 
http://www.innosetup.com/isinfo.php
is free and very good. 
thanks man but is there's any samples or tutorials of using it? 
i found samples with the program package 
now i know how to run the batch file in the setup package
but the original problem is not solved yet:
what is the commands should i write in the batch file to register the program in startup in windows ?
i did search the forum and search google but found nothing?

Jar and Shell

Hi
I have a jar file, and i some how want to run it my clicking it. So in that context how can i use shell script.How can i use shell script to start a jar file?. i am not familar with shell script so example will be helpfull
regards
Why would you want to use a shell script to make this clickable?
What OS and/or windowing environment are you using? 
in both the case this can be used
java -jar the_class_name.class
provided you are using XWindows in linux

Executable Java

Hi! Can anyone help me with my problem? Is there a way to create an executable file in Java? so that i will not type 'java [FILENAME]' to run a file?
if there's no way in Java, can anyone give suggestion of a language that i may use to create an executable file?
thanks in advance.
wednesday 
You can convert a java application into an executable but lose some of the (may be important) java features.
There are many software that allows you to do this.
For an idea, visit the following:
http://www.dobysoft.com/products/nativej/index.html
I used some other product before but can't recall what it is. If I do, I will surely post it again.
iDriZ 
also u can try the following product:
http://www.ej-technologies.com/products/exe4j/overview.html
iDriZ 
You want a language that allows you to execute a Java class? If you are using Windows then a DOS batch script works, and likewise a shell script in Unix. 
If you put all your .class files and possible resources in a .jar with a proper manifest, then you can execute that .jar on almost any platform I know by simply clicking it.
For instance: on MSWindows installing JAVA Runtime gives already rise to a .jar -> javaw -jar <jarfile> <arguments> coupling.
If not, put it in the Registry at HKEY_CLASSES_ROOT\jarfile\shell\open\command
= "C:\Program Files\Java\j2re1.4.1_02\bin\javaw.exe" -jar "%1" %*
On LINUX you need to act likewise.
;JOOP! 
If you put all your .class files and possible
resources in a .jar with a proper manifest, then you
can execute that .jar on almost any platform I know by
simply clicking it.
For instance: on MSWindows installing JAVA Runtime
gives already rise to a .jar -> javaw -jar <jarfile>
<arguments> coupling.
If not, put it in the Registry at
HKEY_CLASSES_ROOT\jarfile\shell\open\command
= "C:\Program Files\Java\j2re1.4.1_02\bin\javaw.exe"
-jar "%1" %*
On LINUX you need to act likewise.
;JOOP!hi! thanks for the help. can you please discuss more about jar files. are there any properties/ fields to set to make that jar file excutable? i encounter some jar files that are executable, others are not, why is this so? can anyone please help me with this. 
Quick question if I may butt in...Is there a way to 'hide' your code in Java, without losing its features and portibility stuff? Like in C++ you can create EXEs and the code can never be read.
Thanks 
Please see the following thread. You will know how to make an executable jar.
http://forum.java.sun.com/thread.jsp?forum=31&thread=371812 
Hi! Can anyone help me with my problem? Is there a
way to create an executable file in Java? so that i
will not type 'java [FILENAME]' to run a file?
if there's no way in Java, can anyone give suggestion
of a language that i may use to create an executable
file?
thanks in advance.
wednesdayGo here:
http://www.excelsior-usa.com/jet.html
This software really really compile the Java code to Win32 Executable, so can be run without any Java Virtual Machine.
The bad thing is, this software cost $750 US for the profesional edition.

Categories

Resources