Starting a JAR File in Linux
Hi,
, to start a jar file in Linux from a file.. how can i do that?... like a .*bat file in windows, or a script file in unix...
Thanks verry much, and sorry my english, (i'm form .UY :) )
java -jar yourJar.jar should work for you. You could create an executable shell script to perform this or setup a file association to execute the file using java -jar whenever you bonk on it.
Similar Messages
-
How to automount jAR file in Linux!
hello,
I am create JAR file. I want to put this JAR file in CD and if an user in linux platform can ablet to locate this JAR file in /usr/bin/myjar folder and open through java -jar jarFile.jar cmd using shell script. Is it possible to uto mount and auto run that JAR file in Linux.
How can find whether JRE is already installed in a system or not.Hi,
Is the Linux your client Platcform? If you want to execute something in the client, you need to use Webutil.
You can use something like,
You can use Client_Host from webutil to invoke an editor (say gedit for linux).
HTH.
Regards,
Arun -
How to start a Jar file in another directory?
Hello!
I have 2 questions, hope someone can help me...
1)
I have a GUI which is placed in C:/java/tmp/GUI.java. When I run this program I want it to start runing a JAR file which is placed in d:/tmpdir/app.jar. How do I do this?
2) How can I get the directory a program is running in?
/ClabbenHello
Yes Rana the main method is placed in GUI.java, and I want this method to start/run the app.jar. The problem is just that these are placed in different directories AND how do I "start/run" the app.jar? The app.jar has also got a main-class. So you can click on it to run it, but I want the GUI.java to do this . Do you, or anyone else, have some code example?
/clabben -
I am wondering if anyone might have a suggestion to this.
I have created a .jar file from JBuilder using the application option in archive builder. ie the jar file should be able to start just by double clicking it. I take the jar file to one of my other machines and it starts fine. I use the java - jar command and it works fine. I double click it in my Windows XP and I get the error: Java Virtual Machine Launcher - "Could not find the main class. Program will exit."
I did read a case in the postings where a startup file was creating havoc, but I don't think I have any java dependent startup's.
I have tried various things like checking my classpath environment variables, associating the file with Javaw from C:\j2sdk1.4.2_03\bin. Any other comments would be appreciated.
cheers
JamesWell, I guess I found the answer of some sort. I tried JWhich from the URL http://www.javaworld.com/javaworld/javatips/jw-javatip105.html, but that didn't work. But, what it did do is that it told the O/S that I had changed the jar launch settings when I went into Tools/options/view File Types of explorer and after highlighting the jar extension. This would have come up if I had changed it to something else anyway. I guess I just didn't notice the little message. The GUI gave me an option if I wanted to restore back to original and walla! it now works.
Hope this is of use to you if you come across this problem and not sure what to do.
cheers..
James -
Oracle 11g application won't start sometimes(jar files issue)
Hello,
The issue we experience is that now and then, our forms 11g application
won't start.
So it can be the case that, for example, the application can be started
succesfully 5 times in a row, but the 6th and 7th time, it won't start
anymore. But when we relaunch it for the 8th time, it launches perfectly.
When the application isn't starting, a new window is opened having a yellow triangle
with an exclamation mark on the top right corner.
After a long period, we suddely discovered that it had something to do with ".jar" files.
Because when we clear the "java jar cache" on the client machine
(start -> control panel -> java -> "general" tab -> "view..." button -> select all the files and click on the
cross(remove selected sources) ), the application succesfully starts for about 10 times in a row.
But the first time we start the application(after clearing the cache), it takes much longer, because the application
is downloading the .jar files again. (java logo appears with a progress bar)
But clearing the cache every time before starting the application can't be a decent solution we think.
When we enable all java debugging info in the console, we received the error below 2 times when launching a application session that refused to start:
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.awt)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkPackageAccess(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at oracle.forms.engine.Main.initDesktop(Unknown Source)
at oracle.forms.engine.Main.start(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Anyone having a clue ?
thanks in advance !Sorry, I meant WEB-INF\lib in the WAR file inside my EAR.
I put all the jar files in the WEB-INF\lib of the WAR file but it still does not work. I have to specify them in the classpaths and put the jar files in the domains\domain\lib directory
I thought if you put it in the WEB-INF\lib then you don't have to put them in the classpath.
Am I right? -
Running .jar files in linux on double click
Hi,
i needed a solution to run the jar files on double click in linux system.Necessity is mainly because when i run the jar file by java -jar myapp.jar in terminal it works fine .Iam running my app continuosly in system tray(a server kind).But if i close the terminal my app exits.
How to resolve this ?I am taking a SWAG.....it sounds like your problem is how to run a java app without a terminal window. So as I recall, there is some way in Linux to enter a command and have it execute in a new process. I don't recall the syntax but maybe putting a '&' character in the command line? Anyway, you should be able to use the method and use "javaw" instead of "java" to launch your app. You should be able to do this in a batch file too. Something like, javaw -jar yourjar.jar &
-
Error Running jar file on Linux Server
Hi,
I recently wrote a small program to be run together when apache is being start up on the server. When the bin/startup.sh is executed, my program will be run together
exec java -classpath ./ZipLogs.jar com.btsoft.magic.zip.ZipFile
I included this command in the startup.sh but the following error came up when I run it:
Exception in thread "main" java.lang.NoClassDefFoundError: com/btsoft/magic/zip/ZipFile
I placed the jar file in the same directory as the startup.sh.
But when I run it directly on the console:
java -classpath ./ZipLogs.jar com.btsoft.magic.zip.ZipFile
its fine..
Can anyone help me with this problem?
Thankswilliammandrake wrote:
I placed the jar file in the same directory as the startup.sh.That would suggest to me that your directory is wrong. I suggest you start by printing out cwd.
Could also be a permissions problem as well. -
Server won't start and JAR files
My application uses external classes (quartz, jersey, jackson) and I included all the jar files containing the external classes in the WEB-INF\lib directory of the EAR file already. I deployed it to WLS 10.3.5 on windows but when I tried to start it up, it failed to start up.
I copied all those jar files and put them in the <domain>\lib directory and add in the classpath section on the ServerStart tab of the server then it started up.
I thought if you include those jar files in the WEB-INF\lib of the EAR file then you don't need to put them in the <domain>\lib and specify in the classpath section?
Do you have any ideas?Sorry, I meant WEB-INF\lib in the WAR file inside my EAR.
I put all the jar files in the WEB-INF\lib of the WAR file but it still does not work. I have to specify them in the classpaths and put the jar files in the domains\domain\lib directory
I thought if you put it in the WEB-INF\lib then you don't have to put them in the classpath.
Am I right? -
Wrapping Jar Files in Linux Executables?
I was wondering how to wrap my Jar file in a Linux Executable. I tried dowloading Launch4j, but that only allowed Windows Executables. Is there an easy way to do this? I'm trying need to be able to pass arguments to the Jar file.
Thanks!And the arguments vary each time the user use your application ?
Then you will have to write a small shell script which takes the user input, e.g. myShellScript.sh var1 var2 ...
Inside the script you place the java -jar myProg call and pass the arguments to it:
cd /path/to/jar
java -jar myProg $1 $2
whereas $1 $2 ... holds the argument(s) which you have passed to myShellScript.sh.
To make it a little bit more comfortable you can define an alias for you myShellScript.sh so there is no need that myShellScript.sh is in /usr/bin,
Is it that what you are looking for?
Edited by: Michael_Knight on 17.11.2008 08:26
I just recognized that you use a debian package ... probably you can ignore my last hint. -
Hi!!
I make a little application and I want make the files who executes the jar file generated to allow user execute the program easily.
In windows i make a .bat file that jost contains "javaw -jar <file.jar>".
but how can i do to make the same in Linux?? what kind of script i must to do?
Thanx!!
PD: sorry my bad english!!You need to write a linux script, something like
javaw -jar <file.jar>
should do fine. Note, under linux the filename and its extension are not important. However you need to make the script executable e.g.
chmod +x <script> -
Deployment Profile Corrupts the jar file in Linux
I am facing the follwing issue in the DROP 6 jdev.
Have created a deployment profile which updates a jar file in <jdev>/extenstion directory. But whenever I try to execute it through jdev, the jar file is getting emptied. Any reason or workarounds for this issue?
thanks
RameshPlease post DROP 6 issues on the Oracle internal discussion forums or to the jdev_us list
-
Jar file not starting properly when in dir with name 2 or more words
Hello,
I have a pretty weird problem here. When I start my jar file from a directory like Test/MyJar.jar everything is fine. But if I try to start it from Test 1/MyJar.jar the file is not running properly. The jar file reads files from it's directory and the message I receive is can't find Test20%1/MyFile.txt.
Any help will be appreciated.Anyway. Probably the easiest thing is to not read from the directory. Rather, put the files you need to read into the Jar file itself, and read them using Class.getResourceAsStream.
This is a workaround, but it's a good one. -
Hi all,
If I want to find out a class resides under what jar file, under Linux, I use this command:
for i in $(find -name \*.jar) ; do if jar tf $i | grep �q className.class ; then echo $i ; fi ; done
Does anybody know how can I do this under Windows? If I need to know a class is under what jar file, is there anyway to do this except extracting each jar file and see what classes are under the jar file?
Is there any tool that can mount the jar file and expand it in a tree structure to see all of it's classes visually?
Any help is greatly appreciated.if you have a lot of jars, its actually time-consuming....Sorry, my computer freez.
Vector<String> parcalar=null;
try {
JarFile jarfile = new JarFile(new File("lang.jar"));
Enumeration<JarEntry> dosyalar=jarfile.entries();
parcalar=new Vector<String>();
System.out.println(jarfile.size()-2);
while(dosyalar.hasMoreElements()) {
JarEntry entry = dosyalar.nextElement();
String name=entry.getName();
if(name.equals("MessagesBundle.properties")) {
//parcalar="--------------------";
else if(name.equals("META-INF/MANIFEST.MF")) {
else {
parcalar.addElement(name);
catch(IOException ex){
ex.printStackTrace();
System.out.println(parcalar); -
Java Application as jar File cannot connect to SAP via JCO
Hey guys,
I wrote a test class to play a little with the java connector. Everything worked fine.
Now I want to pack my java class and the JCO classes in one jar file. I have written a manifest file with the Main-Class statement and after I start the jar file I got following exception:
Exception in thread "main" java.lang.ExceptionInInitializerError: JCO.classIniti
alize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjco
rfc in java.library.path]. java.library.path [C:\WINDOWS\system32;.;C:\WINDOWS\S
ystem32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Ja
vaConnector\sapjco.jar;C:\j2sdk1.4.2_12\bin;]
at com.sap.mw.jco.JCO.<clinit>(JCO.java:776)
at de.lymez.sti.SAPAufruf.getDocnr(SAPAufruf.java:26)
at de.lymez.sti.Aufruf.main(Aufruf.java:12)
Can anyone help me? I don't think that I forget something during the JCO installation, because my class file worked fine and give me the correct values out of the SAP System.
Best regards,
TimoThanks Vladimir,
but I followed the Tutorial and copied every dll in the wright folder and set the pathes. In one of the threads someone told about a tool named dependency walker. I used this with the sapjcorfc.dll and the tool answered that the DRVADODB.DLL is not found. Can anyone send me this dll? And why worked everything fine, when I use the class? I only have problems when I use one jar file!
Thanks for any help!!
Regards,
Timo -
I made one project whit DB on NET BEANS, but when i start my jar file, who is automaticly generated by NET BEANS my DB jobs doesen't work and when i start my jar file on oder computer the images on icons disappear.
I agree - you need to post more information.
Check out http://forum.java.sun.com/thread.jspa?threadID=5173326 and http://forum.java.sun.com/thread.jspa?threadID=5156691&messageID=9593420 for examples.
Maybe you are looking for
-
How to Copy the PLD from one database to another
Dear Members, i have designed the PLD for Purchase Order, i want to copy the particular PLD into another Database. i tried to copy the PLD from one database to another through copy express.. i copied the PLD sucessfully. But the problem is,it cop
-
I am having problems with my zen xtra 60gb. It's worked fine until today. First it would recognize my player but when I tried to transfer it said player not connected. After a few attempt it would no longer even recognize my player was plugged. I hav
-
I have some problems using Mail on Macbook with icloud account. It worked the day of the realease but now I can't get my email and it says that it cannot connect to the server. Someone knows what can I do? Thanks
-
Transfer addresses from local to icloud
hi I entered a lot of adresses initially to the local area but like to transfer them to icloud to share them with my different devices. I do not find a way described. Does anybody could help? Thanks
-
Hello,. I am trying to send an app to Apple but the Marketing Version on my DPS App Builder is 1.0.3 and the latest version on iTunes Connect is 1.1 (Note the previous app was created with a different technology).. How can I edit this version so Appl