Skip to main content



      Home
Home » Newcomers » Newcomers » Newbie need help to create a standalone java program
Newbie need help to create a standalone java program [message #105520] Wed, 28 September 2005 00:50 Go to next message
Eclipse UserFriend
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 #107928 is a reply to message #105520] Fri, 07 October 2005 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: terencems.discovery.co.za

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.
Re: Newbie need help to create a standalone java program [message #109213 is a reply to message #107928] Thu, 13 October 2005 13:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martinyeh.psu.edu

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
Re: Newbie need help to create a standalone java program [message #109225 is a reply to message #109213] Thu, 13 October 2005 14:53 Go to previous messageGo to next message
Eclipse UserFriend
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 #109263 is a reply to message #109225] Thu, 13 October 2005 22:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martinyeh.psu.edu

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
>
Re: Newbie need help to create a standalone java program [message #109288 is a reply to message #109263] Thu, 13 October 2005 23:59 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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-)
Previous Topic:Using Eclipse with the WebLogic WSDLC Ant task
Next Topic:Windows Exectuable *.exe
Goto Forum:
  


Current Time: Sun May 11 09:49:35 EDT 2025

Powered by FUDForum. Page generated in 0.08843 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top