NetBeans is no longer generating a JAR file for code that it used to
Asked Answered
M

3

1

Two years ago I wrote a simple upload applet using Java, developed using NetBeans. When I first hit "Clean and Build" back then, and for some time afterwards, it worked perfectly. It would run through the build process and produce a JAR file that I could then upload to my web server, and the applet worked great.

Now, as I'm going back in and making some slight modifications to this applet, it no longer produces the JAR file when I hit "Clean & Build." The actual code changes I made are so minute that I can guarantee they would have no bearing on this (literally just changing the contents of a few strings). I know that since the time I originally built this applet my NetBeans has upgraded itself a couple of times (right now I'm on version 6.9.1), so I wonder if the newer versions are now somehow buggy.

Don't know if this helps, but this class is "self-signed" (in the "Web Start" tab of the Project Properties), and below I've included the output of the "clean,jar" pane on the bottom of NetBeans. I noticed that it says jar: and then doesn't say anything else but skips right to BUILD SUCCESSFUL. I'm assuming that something should happen in between there?

init:
deps-clean:
Updating property file: C:\NetBeansProjects\MyApplet\build\built-clean.properties
Deleting directory C:\NetBeansProjects\MyApplet\build
clean:
init:
deps-jar:
Created dir: C:\NetBeansProjects\MyApplet\build
Updating property file: C:\NetBeansProjects\MyApplet\build\built-jar.properties
Created dir: C:\NetBeansProjects\MyApplet\build\classes
Created dir: C:\NetBeansProjects\MyApplet\build\empty
Compiling 1 source file to C:\NetBeansProjects\MyApplet\build\classes
C:\NetBeansProjects\MyApplet\src\MyApplet.java:189: warning: [unchecked] unchecked conversion
found   : <anonymous java.security.PrivilegedAction>
required: java.security.PrivilegedAction<T>
        Object doPrivileged = AccessController.doPrivileged(new PrivilegedAction() {
C:\NetBeansProjects\MyApplet\src\MyApplet.java:189: warning: [unchecked] unchecked method invocation: <T>doPrivileged(java.security.PrivilegedAction<T>) in java.security.AccessController is applied to (<anonymous java.security.PrivilegedAction>)
        Object doPrivileged = AccessController.doPrivileged(new PrivilegedAction() {
2 warnings
compile:
Created dir: C:\NetBeansProjects\MyApplet\dist
jnlp:
Deleting: C:\NetBeansProjects\MyApplet\helper.txt
Going to create default keystore in C:\NetBeansProjects\MyApplet/build/nb-jws.ks
Generating Key for nb-jws
sign-jars:
generate-jnlp:
Copying 1 file to C:\NetBeansProjects\MyApplet\dist
Deleting: C:\NetBeansProjects\MyApplet\dist\launch.jnlp_
generate-html-preview:
Copying 1 file to C:\NetBeansProjects\MyApplet\dist
jar:
BUILD SUCCESSFUL (total time: 1 second)
Mariannemariano answered 1/4, 2011 at 14:20 Comment(0)
M
3

Well, I'm not sure why it was giving me that trouble, but I found a solution. The solution was to simply delete and then re-create the entire project from scratch, and then try compiling again. I'm guessing that NetBeans has updated the way they do manifest files or something like that with the different versions, and it was choking on the older version.

Mariannemariano answered 1/4, 2011 at 19:34 Comment(2)
Did you ever find a real solution to this? I'm having the same problem, but I don't want to start over. :-(Onto
@KSK: You can create a new NetBeans project, then copy your source files to the new project. The important thing isn't literally starting over - It's just forcing NetBeans to create new project files.Sewell
N
2

Had the same problem with Netbeans 7.1 and a project started with Netbeans 7.0.1.
When building the project, the the jar file was lacking some files, in my case the Main class. Recreating the project worked this out for me too. Thanks a lot!

Numbing answered 9/3, 2012 at 6:52 Comment(0)
M
0

Option 1: I tried to run the IDE with "Run as Administrator". It helped me to create the jar file properly

Option 2: a. After running "Clean and Build" Go to Netbeans Maven Project Navigator and right-click on the Execute Goal With Modifiers...

Maven Project Navigator of Netbeans

b. Remove "test-" from "org.apache.maven.plugins:maven-jar-plugin:2.3.2:test-jar" and selecting all the checkboxes as shown below (You may like to use the command later by selecting the "Remember as" checkbox)

Maven Window

I hope it will help someone

Maxentia answered 18/8, 2016 at 13:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.