This looks like a necessary update for Java10 and shall be submitted as a
PR against one issue created for this topic.
Please think over it.

with regards
    Tushar



On Mon, Aug 20, 2018 at 9:11 PM Andreas Hauffe <andreas.hau...@tu-dresden.de>
wrote:

> Hi,
>
> thanks for the hint.
>
> But I just change the code of the windows installer launcher of netbeans
> so that it is working for Java 10. This was quite a pain, due the fact,
> that I do not really understand how the build process during the IDE
> compilation is working. Some ZIP files are used which override all changes
> of native executables with netbeans 8.2 executables.
>
> I changed line 125 - 181 of
> https://github.com/apache/incubator-netbeans/blob/master/nbi/engine/native/launcher/windows/src/JavaUtils.c
> to the following and copied the compiled nbi-engine.jar to
> netbeans/harness/modules/ext/ manually.
>
> ----
>
> JavaVersion * getJavaVersionFromString(char * string, DWORD * result) {
>     JavaVersion *vers = NULL;
>     if(getLengthA(string)>=3) {
>         char *p = string;
>
>         // get major
>         long major = 0;
>         while(p!=NULL) {
>             char c = p[0];
>             if(c>='0' && c<='9') {
>                 major = (major) * 10 + c - '0';
>                 p++;
>                 continue;
>             }
>             else if(c=='.'){
>                 p++;
>             }
>             else{
>                 return vers;
>             }
>             break;
>         }
>
>         // get minor
>         long minor = 0;
>         while(p!=NULL) {
>             char c = p[0];
>             if(c>='0' && c<='9') {
>                 minor = (minor) * 10 + c - '0';
>                 p++;
>                 continue;
>             }
>             break;
>         }
>
>         *result = ERROR_OK;
>         vers = (JavaVersion*) LocalAlloc(LPTR, sizeof(JavaVersion));
>         vers->major  = major;
>         vers->minor  = minor;
>         vers->micro  = 0;
>         vers->update = 0;
>         ZERO(vers->build, 128);
>
>         if(p!=NULL) {
>             if(p[0]=='.') { // micro...
>                 p++;
>                 while(p!=NULL) {
>                     char c = p[0];
>                     if(c>='0' && c<='9') {
>                         vers->micro = (vers->micro) * 10 + c - '0';
>                         p++;
>                         continue;
>                     }
>                     else if(c=='_') {//update
>                         p++;
>                         while(p!=NULL) {
>                             c = p[0];
>                             p++;
>                             if(c>='0' && c<='9') {
>                                 vers->update = (vers->update) * 10 + c -
> '0';
>                                 continue;
>                             } else {
>                                 break;
>                             }
>                         }
>                     } else {
>                         if(p!=NULL) p++;
>                     }
>                     if(c=='-' && p!=NULL) { // build number
>                         lstrcpyn(vers->build, p, min(127,
> getLengthA(p)+1));
>                     }
>                     break;
>                 }
>             }
>         }
>     }
>     return vers;
> }
>
> ----
>
> --
> Regards,
> Andreas Hauffe
>
>
>
>
>
>
> Am 20.08.2018 um 12:23 schrieb Neil C Smith:
>
> You might want to check out the thread around using InnoSetup for this
> from around Aug 1st too.
>
> Best wishes,
>
> Neil
>
> On Mon, 20 Aug 2018, 08:55 Andreas Hauffe, <andreas.hau...@tu-dresden.de>
> wrote:
>
>> Hi,
>>
>> I tried with Netbeans 9 and JDK8/JRE8 and this is working.
>>
>> The verbose output of running the windows installer with a bundled JRE10
>> is the following:
>>
>> 2018-08-20 09:48:12.421]> Create new process:
>> [2018-08-20 09:48:12.421]>           command :
>> C:\Users\${USER}\AppData\Local\Temp\\NBI25406.tmp\_jvm\bin\java.exe
>> -classpath C:\Users\${USER}\AppData\Local\Temp\\NBI25406.tmp TestJDK
>> [2018-08-20 09:48:12.421]>         directory : C:\Temp
>> [2018-08-20 09:48:12.437]> ... process created
>> [2018-08-20 09:48:12.682]> ... process finished his work
>> [2018-08-20 09:48:12.682]>            output :
>> 10.0.2
>> 10.0.2+13
>> Oracle Corporation
>> Windows 10
>> amd64
>>
>> [2018-08-20 09:48:12.682]>     java.version =  10.0.2
>> [2018-08-20 09:48:12.698]>     java.vm.version = 10.0.2+13
>> [2018-08-20 09:48:12.698]>     java.vendor = Oracle Corporation
>> [2018-08-20 09:48:12.714]>     os.name = Windows 10
>> [2018-08-20 09:48:12.714]>     os.arch = amd64
>> [2018-08-20 09:48:12.714]>
>> [2018-08-20 09:48:12.729]> ... getting java version from string :
>> 10.0.2+13
>> [2018-08-20 09:48:12.729]> ... some java there
>> [2018-08-20 09:48:12.729]> ... no java at
>> C:\Users\${USER}\AppData\Local\Temp\\NBI25406.tmp\_jvm
>> [2018-08-20 09:48:12.745]> ... check private jre at
>> C:\Users\${USER}\AppData\Local\Temp\\NBI25406.tmp\_jvm\jre
>> [2018-08-20 09:48:12.745]> ... not a java hierarchy
>> [2018-08-20 09:48:12.760]> ... no java was found
>>
>> --
>> Regards,
>> Andreas Hauffe
>>
>>
>>
>> Am 20.08.2018 um 08:13 schrieb Geertjan Wielenga:
>>
>> First try to bundle JRE 8. If that works, then try to bundle JRE 10.
>> Doing it like this makes it easier to narrow down the problem.
>>
>> Gj
>>
>> On Mon, Aug 20, 2018 at 8:10 AM, Andreas Hauffe <
>> andreas.hau...@tu-dresden.de> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to bundle a JRE 10.0.2 to a netbeans platform application.
>>> I'm using the following article
>>> https://dzone.com/articles/including-jre-in-nbi and change the part of
>>> creating the zip file of the jre by something like the following lines
>>>
>>> jlink --strip-debug --no-header-files --no-man-pages --output
>>> jre_lin_x64 --module-path ${JRE_PATH}/jmods --add-modules
>>> java.scripting,java.desktop,java.instrument,java.logging,java.naming,jdk.localedata,jdk.management,jdk.pack,jdk.jdwp.agent
>>> --include-locales=en,de
>>> zip -9 -r -y ../jre_win_x64.zip .
>>>
>>> (The commands vary from linux to windows.)
>>>
>>> But when running the installer I'm getting an error that there is no
>>> jre. And in the logs show:
>>>
>>> [2018-08-17 17:21:25.887]> Create new process:
>>> [2018-08-17 17:21:25.887]>           command :
>>> C:\Users\${USER}\AppData\Local\Temp\\NBI60854.tmp\_jvm\bin\java.exe
>>> -classpath C:\Users\ADMINI~1.ILR\AppData\Local\Temp\\NBI60854.tmp TestJDK
>>> [2018-08-17 17:21:25.887]>         directory : C:\Temp
>>> [2018-08-17 17:21:26.180]> ... no java at
>>> C:\Users\${USER}\AppData\Local\Temp\\NBI60854.tmp\_jvm
>>> [2018-08-17 17:21:26.180]> ... check private jre at
>>> C:\Users\${USER}\AppData\Local\Temp\\NBI60854.tmp\_jvm\jre
>>> [2018-08-17 17:30:37.086]> No compatible jvm was found on the system
>>>
>>> But when looking into the path, there is a JRE and a java.exe and the
>>> command is running correctly.
>>>
>>> Did someone have this working already?
>>>
>>> Is there a problem with the version number of Java 10? I'm not used to
>>> C, but when looking into the getJavaVersionFromString from
>>> https://github.com/apache/incubator-netbeans/blob/master/nbi/engine/native/launcher/windows/src/JavaUtils.c
>>> it can be a problem. This is the installer source code, right?
>>>
>>> --
>>> Regards,
>>> Andreas Hauffe
>>>
>>>
>>>
>>

Reply via email to