Quantcast

Maximum PC

It is currently Wed Oct 22, 2014 5:30 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Java Question
PostPosted: Thu Jul 22, 2004 2:10 pm 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
I am trying to rebuild a program I origianlly created in VB 6 in Java. I am trying to obtain the tick count contained within Windows. I know there is a a currentSecondMills() method but it is for current time on the system.

The tick count stores how long the pc has been running during a session (i.e. how long since it was last booted). I have heard that it can be used with Java like any other method but I cannot find any information on its use in the Java forum from sun.com.

If anyone can provide any information it would be greatly appreciated.


Top
  Profile  
 
 Post subject: Re: Java Question
PostPosted: Mon Jul 26, 2004 12:20 pm 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
baldeagle wrote:
I am trying to rebuild a program I origianlly created in VB 6 in Java. I am trying to obtain the tick count contained within Windows. I know there is a a currentSecondMills() method but it is for current time on the system.

The tick count stores how long the pc has been running during a session (i.e. how long since it was last booted). I have heard that it can be used with Java like any other method but I cannot find any information on its use in the Java forum from sun.com.

If anyone can provide any information it would be greatly appreciated.


PM Gadget - he's a local Java Guru and [PC] rated

Manta


Top
  Profile  
 
 Post subject: Re: Java Question
PostPosted: Mon Jul 26, 2004 9:50 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
baldeagle wrote:
I am trying to rebuild a program I origianlly created in VB 6 in Java. I am trying to obtain the tick count contained within Windows. I know there is a a currentSecondMills() method but it is for current time on the system.

The tick count stores how long the pc has been running during a session (i.e. how long since it was last booted). I have heard that it can be used with Java like any other method but I cannot find any information on its use in the Java forum from sun.com.

If anyone can provide any information it would be greatly appreciated.

Sorry this took so long - having a crappy day today.

Anyways, post the section of VB code that you used to obtain the tick count. I'm no windows internals guru, and I don't know diddly about the windows libraries (except that everyone seems to hate them), so that might help point things in the right direction. Java lets you gather quite a bit of system information easily with Properties and Runtime (see the code below), but I don't think there is a way to get at the 'tick count' directly from the Java API.

Possible solutions are calling GetTickCount() using JNI, execute a native command like systeminfo (and get rid of the extra info - easier, but slower), or if windows stores this info in a file, just read it in from there (again, easier and slower). You might be able to read it in directly from the registry - never tried it. Additionally, COBRA might offer something here, but I know diddly-squat about COBRA.

edit: OK - brain is working again. Amazing what a little pizza and beer can do to help you forgot a bad day. :) This version gathers system information from three places: first, it gets system properties using the System.getProperties() method in the Java API; second, it gets runtime information using the Runtime instance; finally, it makes executes the systeminfo windows command as a seperate process and acquires additional system info, including the uptime. Since it is a seperate process, it could be threaded and ran concerrently with the other two - might save a few miliseconds. :)

Yeah, looks like I need to change my host name from amd700 to amd2600 now. Do you get some kind of brownie prize for the longest post ever? I even tried to make the font smaller, but it doesn't work seem to work inside of a code or quote block - sorry about teh length.

Code:
import java.io.*;
import java.util.*;

public class SysInfo {
    public static void main(String[] args) {
       
        System.out.println("System Properties");
        System.out.println("-----------------");
        System.getProperties().list(System.out);
       
        Runtime r = Runtime.getRuntime();
        System.out.println();
        System.out.println("Runtime Information");
        System.out.println("-------------------");
        System.out.println("num processors: " + r.availableProcessors());
        System.out.println("Total jvm memory: " + r.totalMemory()/1024 + " KB");
        System.out.println("Free jvm memory:  " + r.freeMemory()/1024 + " KB");
        if (r.maxMemory() == Long.MAX_VALUE)
            System.out.println("No maximum memory limit set");
        else
            System.out.println("Max.jvm memory:  " + r.maxMemory()/1024 + " KB");
       
        try {
            DataInputStream in = new DataInputStream(r.exec("systeminfo").getInputStream());
            String s  = in.readLine();
            StringBuffer sb = new StringBuffer();
            while (s != null) {
                sb.append(s);
                sb.append("\n");
                s = in.readLine();
            }
           
            System.out.println();
            System.out.println("Systeminfo Command");
            System.out.println("-------------------");
            System.out.println(sb.toString());
        }
        catch (IOException e) {
            e.printStackTrace();
        }
       
        System.out.println("finsihed SysInfo");
        System.exit(0);
    }
}


Output wrote:
System Properties
-----------------
-- listing properties --
java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=C:\Program Files\Java\j2re1.4.2\bin
java.vm.version=1.4.2-b28
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.country=US
sun.os.patch.level=Service Pack 1
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\Documents and Settings\Larry\Deskt...
java.runtime.version=1.4.2-b28
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2\lib\e...
os.arch=x86
java.io.tmpdir=C:\DOCUME~1\Larry\LOCALS~1\Temp\
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows XP
sun.java2d.fontpath=
java.library.path=C:\WINDOWS\system32;.;C:\WINDOWS\Syst...
java.specification.name=Java Platform API Specification
java.class.version=48.0
java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFac...
os.version=5.1
user.home=C:\Documents and Settings\Larry
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=Cp1252
java.specification.version=1.4
user.name=Larry
java.class.path=C:\Documents and Settings\Larry\Deskt...
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=C:\Program Files\Java\j2re1.4.2
java.specification.vendor=Sun Microsystems Inc.
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.4.2
java.ext.dirs=C:\Program Files\Java\j2re1.4.2\lib\ext
sun.boot.class.path=C:\Program Files\Java\j2re1.4.2\lib\r...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...

sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.cpu.isalist=pentium i486 i386

Runtime Information
-------------------
num processors: 1
Total jvm memory: 1984 KB
Free jvm memory: 1844 KB
Max.jvm memory: 65088 KB

Systeminfo Command
------------------

Host Name: AMD700
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 1 Build 2600
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Uniprocessor Free
Registered Owner: AMD700
Registered Organization: CSUF
Product ID: xxx
Original Install Date: 6/29/2004, 4:01:09 AM
System Up Time: 1 Days, 11 Hours, 28 Minutes, 3 Seconds
System Manufacturer: Ssystem manufacturer
System Model: System product name
System type: X86-based PC
Processor(s): 1 Processor(s) Installed.
[01]: x86 Family 6 Model 8 Stepping 1 AuthenticAMD ~2079 Mhz
BIOS Version: A M I - 11000325
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\System32
Boot Device: \Device\HarddiskVolume1
System Locale: en-us;English (United States)
Input Locale: en-us;English (United States)
Time Zone: (GMT-08:00) Pacific Time (US & Canada); Tijuana
Total Physical Memory: 447 MB
Available Physical Memory: 85 MB
Virtual Memory: Max Size: 1,602 MB
Virtual Memory: Available: 881 MB
Virtual Memory: In Use: 721 MB
Page File Location(s): c:\pagefile.sys
Domain: xxx
Logon Server: xxx
NetWork Card(s): 1 NIC(s) Installed.
[01]: NVIDIA nForce Networking Controller
Connection Name: Local Area Connection 3
DHCP Enabled: Yes
DHCP Server: 192.168.1.1
IP address(es)
[01]: 192.168.1.xxx

Finsihed SysInfo



Last edited by Gadget on Tue Jul 27, 2004 12:25 am, edited 1 time in total.

Top
  Profile  
 
 Post subject: Re: Java Question
PostPosted: Mon Jul 26, 2004 9:51 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
MantaBase wrote:
baldeagle wrote:
I am trying to rebuild a program I origianlly created in VB 6 in Java. I am trying to obtain the tick count contained within Windows. I know there is a a currentSecondMills() method but it is for current time on the system.

The tick count stores how long the pc has been running during a session (i.e. how long since it was last booted). I have heard that it can be used with Java like any other method but I cannot find any information on its use in the Java forum from sun.com.

If anyone can provide any information it would be greatly appreciated.


PM Gadget - he's a local Java Guru and [PC] rated

Manta

And PC rated? LOL.... there must have been a mistake somewhere. :)


Top
  Profile  
 
 Post subject:
PostPosted: Tue Jul 27, 2004 11:52 am 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
I wonder if a hyper-threaded processor would show up as one or two processors. Bubba, run that program!!!


Top
  Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 5:34 pm 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
Gadget,

Here is the code you wanted from my VB program. Here is the API code I use to obtain the subroutine from the dll file.

It is just a simple use after doing that to call the subroutine within the program where ever required and do the necessary calculations.

Declare Function GetTickCount Lib "kernel32" () As Long


Top
  Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 7:26 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
baldeagle wrote:
Gadget,

Here is the code you wanted from my VB program. Here is the API code I use to obtain the subroutine from the dll file.

It is just a simple use after doing that to call the subroutine within the program where ever required and do the necessary calculations.

Declare Function GetTickCount Lib "kernel32" () As Long

You still want to do it by calling GetTickCount()? You realize this isn't an accurate count, right? Periods of hibernation are NOT counted, and every 47 or 49 days it will roll back over to 0 - some where in that range. If you have a C or C++ compiler installed, head over to this trail tutorial. It's a pretty simple process - follow the steps. I might trying doing it later using gcc in cygwin just to see how that turns out. It's a four or five step process and it is actually pretty easy* to call a native C/C++ file from Java - a technic commonly refered to as 'dirty java'.

*or maybe I've just been lucky thus far. :)


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 1:45 pm 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
Gadget wrote:
baldeagle wrote:
Gadget,

Here is the code you wanted from my VB program. Here is the API code I use to obtain the subroutine from the dll file.

It is just a simple use after doing that to call the subroutine within the program where ever required and do the necessary calculations.

Declare Function GetTickCount Lib "kernel32" () As Long

You still want to do it by calling GetTickCount()? You realize this isn't an accurate count, right? Periods of hibernation are NOT counted, and every 47 or 49 days it will roll back over to 0 - some where in that range. If you have a C or C++ compiler installed, head over to this trail tutorial. It's a pretty simple process - follow the steps. I might trying doing it later using gcc in cygwin just to see how that turns out. It's a four or five step process and it is actually pretty easy* to call a native C/C++ file from Java - a technic commonly refered to as 'dirty java'.

*or maybe I've just been lucky thus far. :)


I do know that it is not accurate, but it is the only available way I know to get the information I need for my program. At least in VB. The vb program works great.

I did some research online again, but this time I took a different look at the research. I found out that there is a header file (windows.h) that comes with the MS Platform SDK and also comes with VS. This header has the getTickCount contained within according to my research.

I know there is a way to take a custom made file in C++ and have it being used by the program. But is there any way to get a header to be used by Java without much difficulty? Is there any way to import it like the libraries java allows to be imported?


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 1:59 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
baldeagle wrote:
Gadget wrote:
baldeagle wrote:
Gadget,

Here is the code you wanted from my VB program. Here is the API code I use to obtain the subroutine from the dll file.

It is just a simple use after doing that to call the subroutine within the program where ever required and do the necessary calculations.

Declare Function GetTickCount Lib "kernel32" () As Long

You still want to do it by calling GetTickCount()? You realize this isn't an accurate count, right? Periods of hibernation are NOT counted, and every 47 or 49 days it will roll back over to 0 - some where in that range. If you have a C or C++ compiler installed, head over to this trail tutorial. It's a pretty simple process - follow the steps. I might trying doing it later using gcc in cygwin just to see how that turns out. It's a four or five step process and it is actually pretty easy* to call a native C/C++ file from Java - a technic commonly refered to as 'dirty java'.

*or maybe I've just been lucky thus far. :)


I do know that it is not accurate, but it is the only available way I know to get the information I need for my program. At least in VB. The vb program works great.

I did some research online again, but this time I took a different look at the research. I found out that there is a header file (windows.h) that comes with the MS Platform SDK and also comes with VS. This header has the getTickCount contained within according to my research.

I know there is a way to take a custom made file in C++ and have it being used by the program. But is there any way to get a header to be used by Java without much difficulty? Is there any way to import it like the libraries java allows to be imported?

You need to use JNI (Java Native Interface) to import non-java libraries. It shouldn't be very hard - I just don't have a C++ compiler outside of Cygwin on my windows machine.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 2:15 pm 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
Gadget wrote:
baldeagle wrote:
Gadget wrote:
baldeagle wrote:
Gadget,

Here is the code you wanted from my VB program. Here is the API code I use to obtain the subroutine from the dll file.

It is just a simple use after doing that to call the subroutine within the program where ever required and do the necessary calculations.

Declare Function GetTickCount Lib "kernel32" () As Long

You still want to do it by calling GetTickCount()? You realize this isn't an accurate count, right? Periods of hibernation are NOT counted, and every 47 or 49 days it will roll back over to 0 - some where in that range. If you have a C or C++ compiler installed, head over to this trail tutorial. It's a pretty simple process - follow the steps. I might trying doing it later using gcc in cygwin just to see how that turns out. It's a four or five step process and it is actually pretty easy* to call a native C/C++ file from Java - a technic commonly refered to as 'dirty java'.

*or maybe I've just been lucky thus far. :)


I do know that it is not accurate, but it is the only available way I know to get the information I need for my program. At least in VB. The vb program works great.

I did some research online again, but this time I took a different look at the research. I found out that there is a header file (windows.h) that comes with the MS Platform SDK and also comes with VS. This header has the getTickCount contained within according to my research.

I know there is a way to take a custom made file in C++ and have it being used by the program. But is there any way to get a header to be used by Java without much difficulty? Is there any way to import it like the libraries java allows to be imported?

You need to use JNI (Java Native Interface) to import non-java libraries. It shouldn't be very hard - I just don't have a C++ compiler outside of Cygwin on my windows machine.


Alright then let me ask this question. How difficult is it to create a win32 application in C++. I do have VS 6.0 so I do have VC++ 6.0 but we never discussed that in any of our classes. With my ongoing classes and all I never had the time to test it with anything. But my classes do not begin again until late September.

That is one reason I like Java so much. It is so simple to make a GUI application. I do not want this to be another console app. I have other plans for this same program once I get this component developed and working. I have the orginal VB version of this program as freeware at simtel.net and it is called PSSTimer.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 5:07 pm 
Bitchin' Fast 3D Z8000
Bitchin' Fast 3D Z8000
User avatar

Joined: Mon Jun 14, 2004 4:04 pm
Posts: 985
Location: Earth
baldeagle wrote:
Alright then let me ask this question. How difficult is it to create a win32 application in C++. I do have VS 6.0 so I do have VC++ 6.0 but we never discussed that in any of our classes. With my ongoing classes and all I never had the time to test it with anything. But my classes do not begin again until late September.

That is one reason I like Java so much. It is so simple to make a GUI application. I do not want this to be another console app. I have other plans for this same program once I get this component developed and working. I have the orginal VB version of this program as freeware at simtel.net and it is called PSSTimer.


How easy is it? In VC++6.0, it's a nightmare. The Win32 API is a huge pain. Programming in MFC is torturous, I'd rather have a root canal done without anesthaetics than code in Win32. If you want easy Windows programming, go .NET, seriously.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Jul 29, 2004 7:03 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
baldeagle wrote:
Gadget wrote:
baldeagle wrote:
Gadget wrote:
baldeagle wrote:
Gadget,

Here is the code you wanted from my VB program. Here is the API code I use to obtain the subroutine from the dll file.

It is just a simple use after doing that to call the subroutine within the program where ever required and do the necessary calculations.

Declare Function GetTickCount Lib "kernel32" () As Long

You still want to do it by calling GetTickCount()? You realize this isn't an accurate count, right? Periods of hibernation are NOT counted, and every 47 or 49 days it will roll back over to 0 - some where in that range. If you have a C or C++ compiler installed, head over to this trail tutorial. It's a pretty simple process - follow the steps. I might trying doing it later using gcc in cygwin just to see how that turns out. It's a four or five step process and it is actually pretty easy* to call a native C/C++ file from Java - a technic commonly refered to as 'dirty java'.

*or maybe I've just been lucky thus far. :)


I do know that it is not accurate, but it is the only available way I know to get the information I need for my program. At least in VB. The vb program works great.

I did some research online again, but this time I took a different look at the research. I found out that there is a header file (windows.h) that comes with the MS Platform SDK and also comes with VS. This header has the getTickCount contained within according to my research.

I know there is a way to take a custom made file in C++ and have it being used by the program. But is there any way to get a header to be used by Java without much difficulty? Is there any way to import it like the libraries java allows to be imported?

You need to use JNI (Java Native Interface) to import non-java libraries. It shouldn't be very hard - I just don't have a C++ compiler outside of Cygwin on my windows machine.


Alright then let me ask this question. How difficult is it to create a win32 application in C++. I do have VS 6.0 so I do have VC++ 6.0 but we never discussed that in any of our classes. With my ongoing classes and all I never had the time to test it with anything. But my classes do not begin again until late September.

That is one reason I like Java so much. It is so simple to make a GUI application. I do not want this to be another console app. I have other plans for this same program once I get this component developed and working. I have the orginal VB version of this program as freeware at simtel.net and it is called PSSTimer.

I understand what you say about wanting to use Swing. It is a very nice tool to have available. Regarding windows programming with the MFC - probably what DJSpin said - especially for larger projects. I can't say first hand, but I have never met an experienced programmer who said they liked the MFC.

As for the C++ portion (of the larger Java program), it is going to be easy. You just need to include the correct header file and return the value from GetTickCount(). What you want is really nothing more than.....

Code:
//Assuming your class is named Uptime
#include <jni.h>
#include "Uptime.h"     //this is generated with the 'javah -jni Uptime' command
#include "windows.h"

//you'll get this part from the generated java.h file
JNIEXPORT void JNICALL
Java_Uptime_getTickCount(JNIEnv *env, jobject obj)
{
    return GetTickCount();
}


Read the tutorial. This isn't hard! And you'll then have another tool to work with too.


Top
  Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 8:12 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
So how did it turn out?


Top
  Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 8:38 pm 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
Gadget wrote:
So how did it turn out?


Actually I have been doing of research with C++. I have also been doing some testing. I have a good bit of code already.

I got the GetTickCount() to work in C++ in no time. I have all the calculations done and have the loop completed. I have a few minor problems with the while loop but it is working.


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 01, 2004 10:06 am 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
baldeagle wrote:
Gadget wrote:
So how did it turn out?


Actually I have been doing of research with C++. I have also been doing some testing. I have a good bit of code already.

I got the GetTickCount() to work in C++ in no time. I have all the calculations done and have the loop completed. I have a few minor problems with the while loop but it is working.

Is this program just going to display the uptime information or some other information as well?


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 01, 2004 3:46 pm 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
Gadget wrote:
baldeagle wrote:
Gadget wrote:
So how did it turn out?


Actually I have been doing of research with C++. I have also been doing some testing. I have a good bit of code already.

I got the GetTickCount() to work in C++ in no time. I have all the calculations done and have the loop completed. I have a few minor problems with the while loop but it is working.

Is this program just going to display the uptime information or some other information as well?


I want to add the ability of setting alarms on it. So I will have to monitor the current time and check it against the alarm time.

I am currently testing with MFC a little and with different formats of the output, to get it to look just right. LOL

Now let me ask another question. And I do appreciate all the help and interest from everyone. I plan to list everyone who helped in the info of the application. Now the question. How difficult is it to add an application to the system tray or to just hide the application from the task bar while it is running. Remember I am using VC++ 6.0. I know it was a minor pain in VB 6 to add something to the system tray but just some basic API.

Does anyone have any experience with this?


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 01, 2004 8:29 pm 
8086
8086
User avatar

Joined: Wed Jul 14, 2004 9:08 pm
Posts: 80
Well, the only way (to my knowledge) to do that in Java is to create a Win32 application that starts in the systray without a taskbar item and then use the JNI Java invocation API (where you start java from within a C/C++ application) to start your Java app.

That was at least the method we used in our commercial product, so I don't think there is an easier method.


Top
  Profile  
 
 Post subject:
PostPosted: Mon Aug 02, 2004 8:19 am 
8086
8086
User avatar

Joined: Wed Jul 14, 2004 9:08 pm
Posts: 80
It also occurs to me that it is possible to add a systray icon later, but you will first have to start a java app without a taskbar item (such as a service).


Top
  Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 8:25 am 
Thunderbird
Thunderbird
User avatar

Joined: Wed Jul 07, 2004 1:13 pm
Posts: 817
Location: Missouri
Karl the Pagan wrote:
It also occurs to me that it is possible to add a systray icon later, but you will first have to start a java app without a taskbar item (such as a service).


Boy this is creating a lot of great discussion.

I have encountered a new question. I know it is very simple in VB to call a subroutine within inself for the purpose of having it restart.

I was told this is not possible in C++. Is this true and if so then how can I get the same code to repeat until the close the program. It is currently only a console program (i.e. command prompt) for anyone not on windows.


Top
  Profile  
 
 Post subject:
PostPosted: Fri Aug 06, 2004 2:05 pm 
8086
8086
User avatar

Joined: Wed Jul 14, 2004 9:08 pm
Posts: 80
System.exit(1) will kill the Java VM.

If it's running as a service or from JNI invocation API you can force it to restart until it exits with a specific error code (probably zero).


Other than that I'm not sure what you're trying to do... upgrade the program without having to manually restart it? To do that you should look at using a Jar classloader and a little bootstrapping trick.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.