This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198924 - Problems during library additions
Summary: Problems during library additions
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-26 17:01 UTC by bernachesfr
Modified: 2011-11-16 16:47 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The ant output (191.01 KB, text/plain)
2011-05-27 13:31 UTC, bernachesfr
Details
The ant output (191.01 KB, text/plain)
2011-05-27 13:31 UTC, bernachesfr
Details
The zip of the dist folder (733.77 KB, application/x-zip-compressed)
2011-05-27 13:50 UTC, bernachesfr
Details
The original file of the Project BiblioFormat (776.85 KB, application/x-zip-compressed)
2011-05-29 00:05 UTC, bernachesfr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bernachesfr 2011-05-26 17:01:32 UTC
Product Version = NetBeans IDE 7.0 (Build 201104211303)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_25
Runtime = Java HotSpot(TM) Client VM 20.0-b11

Pas de problème si ajout d'une bibliothèque standard ("Ajouter une bibliothèque...")
Problème si ajout d'un projet ("Ajouter un projet...")
Problème si ajout d'u fichier JAR ("Ajouter un fichier JAR ou un dossier...").

Description du problème :
L'application tourne normalement dans l'IDE ("Exécuter le projet principal (F6)").
Le lancement par le fichier JAR généré dans le dossier "dist" par "Nettoyer et construire le projet principal" provoque l'erreur "Could not find the main class : xxx.xxx". Program will exit."
Rappel, le fichier JAR lance correctement l'application si aucune biliothèque n'est ajoutée ou si les biliothèques  ajoutées font partie des Bibiothèques globales.
Comment 1 Marian Mirilovic 2011-05-27 10:00:59 UTC
First of all, please use English while reporting issues against NetBeans, thanks in advance.

simple translation by google translator :
------------------
No problem if adding a standard library ("Add
Library ...")
Problem if adding a project ("Add Project ...")
Problem if u add the JAR file ("Add JAR file or folder ...").

Problem Description:
The application normally runs in the IDE ("Run main project
(F6) ").
The launch of the generated JAR file in the folder "dist"with "Clean and
build the main project "causes the error" Could not Find the Hand
class: xxx.xxx. "Program Will Exit."
Recall, the JAR file launches the application correctly if no driver DLL
is added or added if the libraries are part of the bookcase
overall.
Comment 2 bernachesfr 2011-05-27 10:37:39 UTC
Please excuse me for the use of the French language. I was misled by the report form, itself in French.
I would like to specify the translation of the two last paragraphs:

The launch of the generated JAR file in the folder "dist" with "Clean and build the main project" causes the error "Could not Find the Main class: xxx.xxx. Program Will Exit."
Reminder, the JAR file launches correctly the application if no library is added or if the added libraries are part of Global Libraries.
Comment 3 Tomas Zezula 2011-05-27 11:54:11 UTC
The presence of the library jar on the classpath has no effect on how the application is executed (at least for the j2se project).

It just executes java -cp classpath main_class using the Ant java task.

I suppose the project is a J2SE application project, right?
The main class exists in the main project (it's not a part of added jar), right?
Can you attach the ant verbose output?
Or at least send it by email if the name of main class and jars is confident.
Thanks

You can generate the ant verbose output by setting the Verbosity Level to verbose in the Tools/Options/Miscellaneous/Ant tab.
Thanks!
Comment 4 bernachesfr 2011-05-27 13:31:06 UTC
Created attachment 108548 [details]
The ant output
Comment 5 bernachesfr 2011-05-27 13:31:06 UTC
Created attachment 108549 [details]
The ant output
Comment 6 bernachesfr 2011-05-27 13:31:36 UTC
Thank you for your fast answer.
Yes, the project is a J2SE application project.
Yes, the main class exists in the main project.
I have set the verbosity level on Detailed, I attach the ant output.
Comment 7 Tomas Zezula 2011-05-27 13:34:54 UTC
Can you also attach the ant verbose output of the "Run Application" when it failed.
The compile is not enough the run will contain the java command line used to execute the process.
Thank you!
Comment 8 bernachesfr 2011-05-27 13:50:32 UTC
Created attachment 108550 [details]
The zip of the dist folder

The application normally runs in the IDE.
It doesn’t when I attempt to run this application from the command line without Ant. I attach the zip of the dist folder.
Comment 9 bernachesfr 2011-05-29 00:05:30 UTC
Created attachment 108573 [details]
The original file of the Project BiblioFormat

Continuation of the experiments:

The Library file (BiblioFormat.jar) in the folder dist\lib of the main project (Pharmacie) is not readable:
jar xf "..\..\dist\lib\BiblioFormat.jar"
java.lang.IllegalArgumentException
        at java.util.zip.ZipInputStream.getUTF8String(ZipInputStream.java:311)
        at java.util.zip.ZipInputStream.getFileName(ZipInputStream.java:436)
        at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:255)
        at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:82)
        at sun.tools.jar.Main.extract(Main.java:850)
        at sun.tools.jar.Main.run(Main.java:242)
        at sun.tools.jar.Main.main(Main.java:1149)

The original file ( BiblioFormat.jar) of the Project BiblioFormat in the dist folder is perfectly readable (see the attachment OriginalJar.zip).
I thus copied this file in the directory dist\lib of the main project; then no more error, and I was able to run Pharmacie.jar from command line.

Conclusion: it seems that an error occurs at the time of the generation of the pack of distribution during the copy of jar files indicated as libraries.
Comment 10 Tomas Zezula 2011-05-30 17:43:49 UTC
Seems as a problems with French characters.
Can you please try to change following line in the Pharmacie/nbproject/build-impl.xml:

<copylibs compress="${jar.compress}" index="${jar.index}" .....

to 

<copylibs rebase="no" compress="${jar.compress}" index="${jar.index}" .....

(the rebase="no" was added).
Does it help?
Thanks
Comment 11 Tomas Zezula 2011-05-30 17:44:27 UTC
If it helps I will try to find some nicer fix :-)
Comment 12 bernachesfr 2011-05-30 23:44:28 UTC
Yes, the proposed change corrects, indeed, the error. Thank you. However, the previous versions of NetBeansIDE had not this problem.
Comment 13 Tomas Zezula 2011-05-31 15:02:15 UTC
Thanks for testing.
The change of build-impl.xml is definitely not a fix.
I've just wanted to verify the case.
I am now able to reproduce it locally.
Thanks you very much for the help!
Comment 14 Tomas Zezula 2011-05-31 15:40:52 UTC
Fixed jet-main e3079fa592f4
Hopefully fixed.
I've also added simple way how to turn off the rebase
jet-main b94121c462da
Comment 15 Quality Engineering 2011-06-02 20:55:07 UTC
Integrated into 'main-golden', will be available in build *201106021001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e3079fa592f4
User: Tomas Zezula <tzezula@netbeans.org>
Log: #198924:Problems during library additions
Comment 16 Tomas Zezula 2011-06-03 07:59:29 UTC
Integrated into 7.0.1 b5acd512bc26, 4e44b7e2d1d1