Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Java compile error

Posted on 2011-10-02
23
Medium Priority
?
354 Views
Last Modified: 2012-05-12
I am compiling my code using NetBeans clean and build option and get errors.  The compiler output is included.  Anyone with any ideas - THANKS!

 compileErrors
0
Comment
Question by:sargent240
  • 11
  • 10
  • 2
23 Comments
 

Author Comment

by:sargent240
ID: 36901702
The error is line 17 in embedded file.  Hope that helps
0
 
LVL 4

Expert Comment

by:reijnemans
ID: 36901706
The compiler says that the build is succesfull
BUILD SUCCESSFUL (total time: 0 seconds)

So I'm wondering if there is a problem also because I don't see any errors in the log. The only thing that maybe looks a little bit strange is the next line

Not copying library /home/al/NetBeansProjects/DisplayImage/dist/lib , it can't be read.


But this doens't mean it's wrong
0
 

Author Comment

by:sargent240
ID: 36901724
Some added info.  The programs runs when I run it on the computer I developing on when I select run and run the project.  When I clean and build I get the error.  It still runs if I execute it from the command line ie:

java -jar DisplayImage.jar

When I copy it to another machine it will not run.  I am assuming the error has something to do with that.  I wrote the program a year ago and it has been running on the other machine just fine.  A month ago the hard drive I wrote the program on crashed.  I had to replace the hard drive but had a current back up of the directories I was using to write the program.  I put all the directories on the new hard drive and got some errors that the com.mysql.jdbc.connection could not be found.  I cured that problem and I could make changes and execute the program on the development machine fine.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:reijnemans
ID: 36901734
What is the exact error message you got on the "other" machine, because it seems that some king of library could not be found
0
 

Author Comment

by:sargent240
ID: 36901748
Attached are the error messages I got when I ran the program on the other machine.  The things that are different from the time I first developed the program is I crashed the development hard drive and I am now using Netbeans 7.0.1 and I originally used Netbeans 6.9.?  Again, it runs on my development machine.

 otherMachineErrors
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901753
You need to add mysql driver in the classpath
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901759

Downlod the druver and put it in the classpath:
http://dev.mysql.com/downloads/connector/j/
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901763
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901770

The jar file will be called  in the top levelfolder after you unzip
mysql-connector-java-5.1.17.jar
0
 

Author Comment

by:sargent240
ID: 36901780
I loaded the mysql driver from my suse distro disk.  I am not sure where to go to get it in the class path
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901786
If you are in NetBeans you shoul rightclick the project select properties and the lib and then add jar button
Let me check - and I'll tell you exactly
0
 

Author Comment

by:sargent240
ID: 36901796
I am curious, as the README file in my projects dist directory says to distribute the program I needed to copy the dist and dist/lib directories to the recipient machine.  I did that the first time about a year ago and it ran fine.  I did it this time and these problem popped up.  Just a curious thing.  If I can get an idea as to how to set the class path that would be fine.

THANKS!
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901799
Yes, I was right - right-click project - Proprerties- in the left column of the pop-up winodw - sleect Libararies - on the right Add Jar/Folder
and wbrowse to the jar
0
 

Author Comment

by:sargent240
ID: 36901803
This is what I have in by Compile-time Libraries box

Beans Binding
TopLInk Essentials
/home/al/NetBeansProjects/DisplayImage/dist/lib
MySqlJdbc Driver

0
 

Author Comment

by:sargent240
ID: 36901805
Am I missing one?
0
 

Author Comment

by:sargent240
ID: 36901813
Is the fact that there is not a

/home/al/ and so forth

directory on the recipient machine a problem?
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 36901819

http://wiki.netbeans.org/FaqpackageAndDistribute

To package the project, ZIP up the dist folder (including the lib folder!), and distribute the ZIP file.

so you meant you did it and now you have problems on deployment machine?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901835
check this:
http://www.velocityreviews.com/forums/t141385-how-to-create-executable-jar-in-netbeans-ide.html

Iam not sure this is full information - still look at it:
   
Why use a Eclipse if you can use a well-suited, fast and optimized out-of-the-box-IDE?
Easy as pie: (Netbeans 5.5)

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!

No Modifications/Hacks/buggy DiY-IDE´s, no cry
      
 
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901837
0
 

Author Comment

by:sargent240
ID: 36901843
Thank you very much yan.  I recopied the lib (under dist) directory and all is working fine.  I must not have gotten a good copy the first time.  Your time and efforts are appreciated.  Problem solved.  I am going to put your last post in my three ring binder for future reference.  Again thanks to you both.
0
 

Author Closing Comment

by:sargent240
ID: 36901845
Thanks you very much for the rapid exchange!!
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36901850
You are always welcome.
0
 

Author Comment

by:sargent240
ID: 36901852
I may have to open another question but do you have any idea why when I compile the program it says

Not copying library /home/al/NetBeansProjects/DisplayImage/dist/lib , it can't be read.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

571 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