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 128758 - Bug when creating new Project: Java Application
Summary: Bug when creating new Project: Java Application
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-28 20:44 UTC by bwright
Modified: 2008-12-22 11:56 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Messages Log file (66.42 KB, text/plain)
2008-02-29 19:38 UTC, bwright
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bwright 2008-02-28 20:44:39 UTC
I have previously been able to use NetBeans without any issues.  Now 
today, when I create a new project, what I am getting by default is 
the following: 

<#assign licenseFirst = "/*"> 
<#assign licensePrefix = " * "> 
<#assign licenseLast = " */"> 
<#include "../Licenses/license-${project.license}.txt"> 


<#if package?? && package != ""> 
package ${package}; 


</#if> 
/** 
 * 
 * @author ${user} 
 */ 
public class ${name} { 


    /** 
     * @param args the command line arguments 
     */ 
    public static void main(String[] args) { 
        // TODO code application logic here 
    } 



} 


This is what I used to get: 

/* 
 * HelloWorldApp.java 
 * 
 * Created on February 15, 2008 
 * 
 * To change this template, choose Tools | Templates 
 * and open the template in the editor. 
 */ 


package helloworldapp; 


/** 
 * The HelloWorldApp class implements an application that 
 * simply prints "Hello World!" to standard output. 
 */ 


public class HelloWorldApp { 
    /** Creates a new instance of HelloWorldApp */ 
    public HelloWorldApp() { 
    } 


    /** 
     * @param args the command line arguments 
     */ 
    public static void main(String[] args) { 
        // TODO code application logic here 
    } 



} 


Any help would be appreciated.
Comment 1 Tomas Zezula 2008-02-28 21:17:10 UTC
Seems as a freemarker problem, but I am not able to find out the right component. Jarda will know.
Comment 2 Jaroslav Tulach 2008-02-29 19:20:23 UTC
Give me list of modules that you have enabled - e.g. attach messages.log from your directory. Then reopen the bug.
Comment 3 bwright 2008-02-29 19:38:01 UTC
Created attachment 57580 [details]
Messages Log file
Comment 4 bwright 2008-02-29 19:39:52 UTC
I have attached the messages.log file and reopened the issue as requested.
Comment 5 Denis Anisimov 2008-03-17 14:36:43 UTC
As I understand you concern about absence of constructor 
in your generated class.
But you was able to get generated code with constructor before ?
Is it just 6.0 version problem ?

I cannot compare current behavior in 6.0 and 6.1 ( they are the same )
with previous versions because I don't have previous NB versions.
So possibly the issue is just in template file.

Could you please confirm or disclaim that you care only about default Java file template.
You can put additional lines below inside body of class of your template.
public ${name}{
}
In this case you will get what you want.

So the essence of this issue is just about default template for
Java main class ( and possibly about Java class ).
Is it correct ?
Comment 6 bwright 2008-03-17 14:57:34 UTC
Yes, I was able to get generated code with the constructor before.  As per my original post.  I don't have any other 
versions of NetBeans, only 6.0.

I have fixed this problem.  My computer is set to automatically get Java Updates.  What I did was uninstalled the most 
recent update.  Now I get the proper values for the variables $(name), $(user), and $(package).

Comment 7 Denis Anisimov 2008-03-17 15:06:58 UTC
I'm sorry .
I still don't understand you .
You wrote :

> Now I get the proper values for the variables $(name), $(user), and $(package).
So you got wrong values before for this properties ? 
( I don't see such behavior in your original description of issue ).

You said that now all works fine.
Could you please provide content of template files of Java Main class 
that you have currently ?
Thanks.
Comment 8 bwright 2008-03-17 15:18:03 UTC
You wrote:
>So you got wrong values before for this properties ? 
>( I don't see such behavior in your original description of issue ).

If you look in my original post, the first cut and paste was the values I was getting when creating a new java 
application.  You will see that this was what I was getting:



<#assign licenseFirst = "/*"> 
<#assign licensePrefix = " * "> 
<#assign licenseLast = " */"> 
<#include "../Licenses/license-${project.license}.txt"> 


<#if package?? && package != ""> 
package ${package}; 


</#if> 
/** 
 * 
 * @author ${user} 
 */ 
public class ${name} { 


    /** 
     * @param args the command line arguments 
     */ 
    public static void main(String[] args) { 
        // TODO code application logic here 
    } 
} 



Obviously this was fustrating as I had to delete the fist 4 lines, and change the $(user) to my name, $(name) to the 
name of the java application, and $(package) to the name of the package I was creating.


You wrote:
> Could you please provide content of template files of Java Main class that you have currently ?

Here is what I get when I create a new Java Application Now:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication35;

/**
 *
 * @author bwright
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }

}