Newbie need help to create a standalone java program [message #105520] |
Wed, 28 September 2005 00:50  |
Eclipse User |
|
|
|
Originally posted by: martinyeh.psu.edu
I need helps on deploying my program to other machines. I have a program
running ok under Eclipse IDE, I want to either create a java web start or
some other ways of distributing my program so that I don't have to worry
about whether other machines have appropriate set up for my program. I
don't use anything but pure java. Please let me know where to find
additional information. Thanks in advance.
Martin
|
|
|
|
|
Re: Newbie need help to create a standalone java program [message #109225 is a reply to message #109213] |
Thu, 13 October 2005 14:53   |
Eclipse User |
|
|
|
Originally posted by: weconsul.ptd.net
Martin Yeh wrote:
> Bheku Terence Msimanga wrote:
>> Hi Martin,
>>
>> I used a plugin to deploy a jar file of a project I worked on. The
>> application was a swing-based database front-end.
>>
>> The only problem I had was with some of the images that I had been
>> using. But otherwise I could execute the jar on the target machine
>> without any problems.
>>
>> The plugin you're looking for is call Fat-Jar. You can find it at
>> ecliplse plugin central.
>>
>
> Thank you for your help. I downloaded fat-jar and export an jar. But
> there is still one problem left. Here is the structure in my workbench:
> I have 3 folders: src, resources, and images. I have some text file in
> resources folder and images in images folders. All .java files are under
> src. Some jara file will read the text files under resources. All files
> are put into one jar file.
>
> When I use "jara -jar myprogram.jar", I got error messages complaining
> about "Unknown Source". It seems that jar file does not contain the
> structure. How do I do to keep the folder structure so the java file can
> find those .txt or .png files without problem? I know I could put
> everything under same folder, but I'd prefer retain the structure.
>
> Cheers,
> Martin
I do not use Fat-Jar. I just use the Eclipse export.
- Select the project
- right click on project and select Export
- select jar file
- select 'Export generated class files and resources'
- select 'Compress the contents of jar file'
- select 'Add directory entries'
- Select finish. 'I take the default for all the next screens'
- I do get warnings but for me they are ok.
I then move the new jar file to where I want to run it.
I do not use the java -jar option. I use the classpath option and invoke
my main class with its package prefix as..
java -classpath ..\lib\test.jar org.hsqldb.util.DatabaseManagerSwing %1
This works for me. All of the files are found
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
____________________________________________________________ ______________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
|
|
|
Re: Newbie need help to create a standalone java program [message #109288 is a reply to message #109263] |
Thu, 13 October 2005 23:59   |
Eclipse User |
|
|
|
Originally posted by: weconsul.ptd.net
Martin Yeh wrote:
> I will try that just to see how it works. However, my program will be
> used by people who don't know much about computer, not to mention
> command line environment. So I need to make it work just using doubl-click.
>
> IchBin wrote:
>> I do not use Fat-Jar. I just use the Eclipse export.
>>
>> - Select the project
>> - right click on project and select Export
>> - select jar file
>> - select 'Export generated class files and resources'
>> - select 'Compress the contents of jar file'
>> - select 'Add directory entries'
>> - Select finish. 'I take the default for all the next screens'
>> - I do get warnings but for me they are ok.
>>
>> I then move the new jar file to where I want to run it.
>>
>> I do not use the java -jar option. I use the classpath option and invoke
>> my main class with its package prefix as..
>>
>> java -classpath ..\lib\test.jar org.hsqldb.util.DatabaseManagerSwing %1
>>
>> This works for me. All of the files are found
>>
You can just create a bat file with the Java command to run your
program. You could even create a shortcut and put on their desk top.
Just have them double click the short cut.
An example *example.bat* file would have, in my case, the following..
echo off
java -classpath ..\lib\test.jar org.hsqldb.util.DatabaseManagerSwing %1
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
____________________________________________________________ ______________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
|
|
Re: Newbie need help to create a standalone java program [message #109328 is a reply to message #109288] |
Fri, 14 October 2005 00:40  |
Eclipse User |
|
|
|
Originally posted by: weconsul.ptd.net
IchBin wrote:
> Martin Yeh wrote:
>> I will try that just to see how it works. However, my program will be
>> used by people who don't know much about computer, not to mention
>> command line environment. So I need to make it work just using
>> doubl-click.
>>
>> IchBin wrote:
>>> I do not use Fat-Jar. I just use the Eclipse export.
>>>
>>> - Select the project
>>> - right click on project and select Export
>>> - select jar file
>>> - select 'Export generated class files and resources'
>>> - select 'Compress the contents of jar file'
>>> - select 'Add directory entries'
>>> - Select finish. 'I take the default for all the next screens'
>>> - I do get warnings but for me they are ok.
>>>
>>> I then move the new jar file to where I want to run it.
>>>
>>> I do not use the java -jar option. I use the classpath option and invoke
>>> my main class with its package prefix as..
>>>
>>> java -classpath ..\lib\test.jar org.hsqldb.util.DatabaseManagerSwing %1
>>>
>>> This works for me. All of the files are found
>>>
>
> You can just create a bat file with the Java command to run your
> program. You could even create a shortcut and put on their desk top.
> Just have them double click the short cut.
>
> An example *example.bat* file would have, in my case, the following..
>
> echo off
> java -classpath ..\lib\test.jar org.hsqldb.util.DatabaseManagerSwing %1
>
You may want to try this also using Eclipse. That is, create an
executable jar file. Do the same as before..
- Select the project
- right click on project and select Export
- select jar file
- select 'Export generated class files and resources'
- select 'Compress the contents of jar file'
- select 'Add directory entries'
- HERE do not select FINISH but NEXT
- I select 'export classes with compiler warnings'
- Select NEXT
- Select 'generate Manifest file'
- This is where you make your jar file executable. That is, create a
Manifest file.
- Select 'Browse' for your main class. This is the entry point for
your program. The main class.
- Select FINISH
You now have a jar file that you can exec with the Java -jar command
Hopefully all of your objects .txt or .png files will load.
This is how it is done using Eclipse.
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
____________________________________________________________ ______________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
|
|
Powered by
FUDForum. Page generated in 0.08843 seconds