Put version to my java application - Netbeans

前端 未结 3 1787
轮回少年
轮回少年 2021-02-08 15:07

Is there any way that i can give a version number to my application in netbeans.And then access that version number inside my code.

Something similar to the Assembly num

3条回答
  •  爱一瞬间的悲伤
    2021-02-08 15:30

    Define an Implementation-Version in the manifest of the Jar at build time. It is common to use some form of the date as the version number. E.G. 14.07.28

    The value can be retrieved in code using..

    String version = this.getClass().getPackage().getImplementationVersion();
    

    
        
    
    ...
    
        
            
            
            
            
            
            
        
        
            
            
        
    
    

    This comes from a build file for a project I have open at the moment. The relevant attribute is the last one in the manifest section.

提交回复
热议问题