?
Solved

java execs

Posted on 2012-03-28
9
Medium Priority
?
248 Views
Last Modified: 2012-03-30
Is there a way to bind all the classes built for an application into one executable?
Currently I have to have all the classes in the working/running directory.
0
Comment
Question by:dpalyca755
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 336 total points
ID: 37778955
You could make a 'one jar' installation. Export in Eclipse will do that for you
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1664 total points
ID: 37778960
You can use either Eclipse or Netbeans - they both have facilty t create executable .jar
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1664 total points
ID: 37778969
this is how you craete Exceutabl Jar in Eclipse
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1664 total points
ID: 37778983
this is even simpler to do in Netbeans:
see here descriprtion:
http://www.velocityreviews.com/forums/t141385-how-to-create-executable-jar-in-netbeans-ide.html

right-click your project,
"set main project",
select your project,
"File",
"PROJECTNAME Properties",
"Run",
set your main class,
"Libraries",
"Add JAR/Folder",
select your wanted libs,
do a CLEAN build,
enter the build-path,
enter /dist and be amazed --> DONE!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 37779429
The last i looked, Netbeans can't do a One Jar export
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1664 total points
ID: 37779584
This is pretty simple explanation of dio-it-yourself method
if you want to be independent of any IDE indpendent of any IDE,:



create MANIFEST.MF file with this content:

Main-Class: com.y.app.AppMain
Class-path: third-party.jar blort.jar foo.jar

then run in your top-level class folder

jar cmf MANIFEST.MF app.jar *.class  top_package1 top_package2 ... third-party.jar blort.jar foo.jar ...

it will put  your classes from the default package and then process folders  top_package1 top_package2 recursively and put MANIFEST.MF into meta-inf folder (it will create meta-inf folder within the jar  itself)


Then, you can run AppMain like this:

java -jar app.jar
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 37779590
jar cmf MANIFEST.MF app.jar *.class  top_package1 top_package2 ... third-party.jar blort.jar foo.jar ...

Open in new window


That won't work. You can't nest jars
0
 
LVL 47

Accepted Solution

by:
for_yan earned 1664 total points
ID: 37779617
Yes, it is true, you should not jar the thord-party jars together:

jar cmf MANIFEST.MF app.jar *.class  top_package1 top_package2

you need to mention the put third party jars inMANIFEST and then put them  in the same folder as app.jar


and then you can  run it

java -jar app.jar

I tried it condensing there together thinking thatmaybe newer java works with it,
and it worked for me, but that happened because actuallt another copy of jar was present in the same folder
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 37787121
Not quite sure why you accepted that answer. The instructions given, while correct in themselves, don't fulfill your requirement
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question