Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

executable java files

 
Michael Raymond Jr.
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so i made a jar archive and it works just fine on my box at work and at home.

i just emailed it to someone and they get an error like :"can't find main class".

in the manifest file i have(with new line feed): Main-Class: CiscoProfiles

and that's it. again, works on computer at work and home, but not someone else's work computer.

the only difference is that mine has sdk, where theirs only has jre.

so, does the jre run jar files??? if not, then how do I get the jar file to be executable on people's computers without having to install the sdk AND without having to install other software?
 
Michael Raymond Jr.
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do i need to modify my manifest file to include ./Ciscoprofiles ?

i don't want to try again until i know how things work
 
Michael Raymond Jr.
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone?

to run an executable jar does one need the sdk, or is the jre enough? and if the latter is true, is there supposed to be special configurtion?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PatienceIsAVirtue

The JRE is sufficient, and it should not require any special setup. How are they trying to run this file? What is the exact error message?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15484
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Main-Class: CiscoProfiles

Is your class in a package? You need to specify the fully qualified name (including the package name) in the manifest file.

Also, does the manifest file end with a newline? Note what this tutorial says:
Warning: The text file from which you are creating the manifest must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.
 
Michael Raymond Jr.
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
PatienceIsAVirtue

The JRE is sufficient, and it should not require any special setup. How are they trying to run this file? What is the exact error message?




thanks everyone for the response...i submitted it to someone as if it were good as gold and ready to be deployed, only to find out that the first person I tried it on did not work, so that i'm freaking out.


they have JRE installed for sure. the error is the infamous:""Could not find main class. Program will exit." " i just tried it on another work computer with the same JRE (1.4.2) and same error message. this means that every computer in the company can't run this executable JAR now most likely. all have windows XP.


again, it's an executable jar so i'm just having them double click it. i compiled it with jar cvfm.... works at home on 3 computers now (2 with sdk and one 1 jre) simply double clicking it. it has the manifest file in it and two class files. those 3 computers at home are also windows xp. the one 1 with only JRE MAy have had sdk installed at one point.


the two class files are not in packages and even if they were, why would it work at home and not at work if that were an issue??? manifest file is:

and that's it. new line of course. is it missing somethign that would only work on certain JRes? works got java ver 1.4.2 and I got the new 1.6 update2 or whatever it's called now.




what's the deal here? why can't i run this at work? any ideas are welcomed.
 
Michael Raymond Jr.
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on the computers it doesn't work on i noticed the icon is that of like a blank document, not a java file. my work computer (has sdk) and ones at home show the java symbol on the file.

however, the ones it doesn't work on does say it's an executable jar file, so it seems windows is recognizing the file type and that it's marked as executable, just the JRE class loader can't find main. sounds like a java JRE issue, not windows or my code.



just some more information. and someone asked me why i didn't use a MS batch file instead...
 
Michael Raymond Jr.
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, i updated the JRE ONLY on one of the machines my program didn't work on to 1.6 JRE and now my program (jar) has the java symbol and works.



--------------------------------------------
so, now it's not me for sure, and it's the JRE on these computers. what could possibly be done to the 1.4 JRE install to prevent my program from running?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic