NoClassDefFoundError when not in Eclipse
I developed a standalone app in eclipse, and it works fine. I created the .jar file, and set it up for distribution, but when i execute it outside of Eclipse, i get a NoClassDefFound error on JCO$Record.
I can see the class in the sapjco.jar file, and i have this file on my classpath. i also have my JCO install folder in my path, so windows can find the .dlls.
I am not sure what is wrong. I check my classpath and path immediately after the exception, and they look fine. i am specifying the classpath with a set statement, and not the -cp extension, if that makes a difference.
actually, i already do what you suggest. here is my .bat file (please disregard strange newlines in SETs):
@echo off
set OCP=%CLASSPATH%
set OP=%PATH%
set CLASSPATH=c:\JCO\sapjco.jar
set CLASSPATH=%CLASSPATH%;c:\xerces-1_4_4\xerces.jar
set CLASSPATH=%CLASSPATH%;c:\java\MSJDBC\lib\mssqlserver.jar
set CLASSPATH=%CLASSPATH%;c:\com\siemens\SMMSAPInterface.jar
set CLASSPATH=%CLASSPATH%;c:\java\j2sdk1.4.2\jre\lib\rt.jar;
set PATH=%PATH%;c:\jco\;
java -verbose:class -cp %CLASSPATH% -jar c:\com\siemens\SMMSAPInterface.jar
set CLASSPATH=%OCP%
set PATH=%OP%
the CLASSPATH% variable and PATH variable are correct when i look at them (before the final 2 sets), but jvm sill cannot fin sapjco.jar in c:\jco
Similar Messages
-
NoClassDefFoundError when passing HttpSession
Hello All,
I am getting a NoClassDefFoundError when I start my rmi server.
I am pass an HttpSession as one of the variables of my rmi call.
Everything worked fine until I added the HttpSession variable.
Why do I get this exception ?
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/Ht
tpSession
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.privateGetPublicMethods(Class.java:2519)
at java.lang.Class.getMethods(Class.java:1406)
at sun.rmi.server.Util.getRemoteInterfaces(Util.java:221)
at sun.rmi.server.Util.getRemoteInterfaces(Util.java:193)
at sun.rmi.server.Util.createProxy(Util.java:126)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:169)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:293)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:235)
at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:133)
at java.rmi.server.UnicastRemoteObject.<init>(UnicastRemoteObject.java:119)
at pE.PEg.<init>(PEgImpl.java:36)
at pE.PEgServer.<init>(PEgServer.java:10)
at pEngine.PEgServer.main(PEgServer.java:18)If I add server2_2.jar to my class path, then I get this exception:
java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionWhile were at it, let me ask this: My RMI implementation code has some data that it needs to pass to my servlet that is invoked by an third-party server. I due to the sensitive nature of the data, I don't want to stick it in a DB, but pass as session variables, thus I was passing in the session var. A better way to do this?
Edited by: jimcsc on Aug 29, 2008 9:58 AMI am getting a NoClassDefFoundError when I start my rmi server.That will be because either the server or the Registry or the client doesn't have the class named in the exception in its CLASSPATH.
I am pass an HttpSession as one of the variables of my rmi call.Are HttpSessions really serializable? This sounds like a very odd design.
While were at it, let me ask this: My RMI implementation code has some data that it needs to pass to my servlet that is invoked by an third-party server. I due to the sensitive nature of the data, I don't want to stick it in a DB, but pass as session variables, thus I was passing in the session var.There's something wrong with that description. It seems to me that it is the servlet passing the HttpSession to your RMI server, not the other way around. Assuming the HttpSession implementation is serializable it should work but it's still an odd design. I would get the stuff that you actually need out of the HttpSession and pass that. -
Exception in thread main java.lang.NoClassDefFoundError when Install 11g 2
Exception in thread main java.lang.NoClassDefFoundError when Install Oracle database 11g release 2 on redhat linux enterprise 5
My Java Version is 1.6.0_13-b03, can anyone help?
Error Message as follows:
准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2009-12-01_11-25-58AM. 请稍候...[oracle@redhatlinux ~]$ Exception in thread "main" java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at java.awt.Toolkit$2.run(Toolkit.java:821)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
at com.jgoodies.looks.LookUtils.isLowResolution(Unknown Source)
at com.jgoodies.looks.LookUtils.<clinit>(Unknown Source)
at com.jgoodies.looks.plastic.PlasticLookAndFeel.<clinit>(PlasticLookAndFeel.java:122)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1783)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:480)
at oracle.install.commons.util.Application.startup(Application.java:758)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:164)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:265)
at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:114)
at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:132)I am getting the same exception. I tried using xhost_+ but it's still not working for me.
Again, here is the error that I'm receiving when trying to install Oracle 11g:
Exception in thread "main" java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at java.awt.Toolkit$2.run(Toolkit.java:821)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
at com.jgoodies.looks.LookUtils.isLowResolution(Unknown Source)
at com.jgoodies.looks.LookUtils.<clinit>(Unknown Source)
at com.jgoodies.looks.plastic.PlasticLookAndFeel.<clinit>(PlasticLookAndFeel.java:122)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1783)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:480)
at oracle.install.commons.util.Application.startup(Application.java:758)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:164)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:265)
at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:114)
at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:132)
Thanks in advance for the help!!
Also, this is all very new to me. So if you could provide a step-by-step answer I would really appreciate it.
Edited by: user9014123 on Jan 25, 2010 1:40 PM -
Why can't I send e mails when not on wifi at home?
My phone contract is with Orange and my internet provider is Eclipse. I have spend hours on the phone to both Orange and Eclipse to no avail. It is causing me huge problems as I rely on my phone for my business to e mail etc. I have changed from a Blackberry to this I Phone 5 and it is driving me made. Should I ditch it and go back to Blackberry?
Probably because your smtp setting is configured for your regular isp and they likely, as do many, do not allow sending email using their smtp server when you are not connected to their network. Contact your isp and ask them, or look at their site for the smtp settings for using their smtp server when not on their network. This is a spam prevention measure employed by most ISPs.
-
This is a repost to correctly ID this as a Spaces issue. I am using a MacBook Pro with a second monitor in extended desktop. I put iMovie in full screen and when I put it back, it disappeared off of both desktops. I can see it in Spaces and I can use it in full screen. However, it is not available when not in full screen. When I drag and drop it in Spaces to a desktop, it animates off of the top of the screen versus landing on that desktop. I have tried to change the application assignment by right clicking on the iMovie Icon > Options > Assign To, but it affects nothing. I have rebooted both with the external monitor and without, I have uninstalled and reinstalled iMovie and I have tried many combinations of screen resolutions and it is still assigned somewhere other than a desktop. It appears to no longer be associated with or assignable to a desktop. Anyone have any ideas?
Can you access iMovie without being in fullscreen when you do not have an external monitor connected? I cannot. No matter the monitor configuration, it is only accessible in full screen for me.
I agree - it is for sure a bug. -
Re: [iPlanet-JATO] Re: session timeout when not submitting to a handler
Mark--
I know what's happening here, but am curious about your approach. You said
in an earlier email that you were generating links directly to JSPs, but
from what you are describing, you are generating JATO-style links to access
JATO pages. Nothing wrong with that, but there is a signficant difference.
Actually, it just occurred to me, I'm wondering what your URLs look like.
The way the request dispatching works in JATO is it ignores anything after
an initial "." in the final part of the URL path. For example, a request
for "/myapp/module1/MyPage.jsp" doesn't actually try to hit the JSP, instead
it tries to hit the JATO page "/myapp/module1/MyPage".
The end result is that you may think you are accessing a JSP directly, but
are instead accessing a JATO page. The reason the request dispatching works
this way is because it is illegal to access JATO JSPs directly, and there is
actually a (disabled) JATO feature that piggybacks on the use of the
dot-delimited URL.
So, now I need to understand your intent. I wasn't really sure why you were
generating direct JSP/page links to begin with. This works against the Type
II architecture JATO uses, in which all JATO requests go back to the
controller servlet.
If you are trying to design something like a menu page, you may have thought
that it was burdensome to create a number of HREF children, plus implement
event handlers for each of them. This definitely would be burdensome beyond
just a handful of links, but this is why JATO provides other mechanisms for
doing what I'll call here "polymorphic HREFs".
Assuming this menu page scenario, the easiest thing to do is to simply use
one HREF child on the page, and add a value to it each time it is rendered
that distinguishes it from the other instances on the page. In your event
handler for the HREF, you simply check this value and use it to decide which
page to forward to. You can add a value to an HREF or Button by using the
"addExtraValue()" method. Or, if you are using JATO 1.2, you can add extra
query string NVPs right in the JSP document using the "queryParams"
attribute of the <jato:href> tag. Thus, your one HREFchild and event
handler become "polymorphic" because what they do depends on the context in
which they are invoked.
Now, I still don't have confirmation that this is what you were trying to
do, so until I do, let me explain the exception you're seeing. JATO assumes
that when a request comes in for a page that includes the pageAttributes
NVP, it is a request coming from a previously generated JATO page. Because
of the way JATO works, this means that the request dispatching code should
send the request back to the originally rendered page. For example, if Page
A renders an HREF, which the user then activates, JATO sends the request
back to Page A for handling. All of the HREFs and forms generated during
rendering of Page A actually refer back to Page A, regardless of where those
links or buttons actually pass the request in their event handlers/Command
objects.
So, what's happening when you include the pageAttributes in your HREFs is
that JATO is assuming that a request is being sent to the target page, with
the assumption that the target page has a mechanism in place to handle the
request. This assumption relies on the specification of the "originator" of
the request being specified in the request. For links/HREFs, the name and
value of the HREF is sent along with the request. For forms, the name and
value of the button that was pressed are sent in the request. JATO uses the
presence of these name/value pairs to decide which event handler, or which
Command object, to invoke to handle the request.
The exception you are receiving is saying that there was no object on the
target page that indicated it could handle the request. This is to be
expected, since you have not specified a query parameter that indicates
which CommandField child is responsible the request. However, this is where
I see the disconnect, because that is not what I believe you were trying to
do (as explained above).
So now, given all the information above, can you tell me what you're trying
to accomplish, and whether or not the info I've given you has helped you to
design a mechanism more in line with a JATO approach? If not, given that I
understand what you're trying to do, I can offer a more concrete solution.
Todd
----- Original Message -----
From: <Mark_Dubinsky@p...>
Sent: Monday, November 05, 2001 2:54 PM
Subject: [iPlanet-JATO] Re: session timeout when not submitting to a handler
This is the exception we get:
(And BTW, leaving a blank value for the pageAttributes doesn't help)
[05/Nov/2001 17:49:18:4] error: <portalServlet.processRequest>
javax.servlet.ServletException: The request was not be handled by the
specified handler
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at
javax.servlet.ServletException.<init>(ServletException.java:107)
at
com.putnaminvestments.common.jato.ApplicationServletBase.dispatchRequ
est(Compiled Code)
at
com.putnaminvestments.common.jato.ApplicationServletBase.processReque
st(Compiled Code)
at
com.putnaminvestments.bp.portal.portalServlet.processRequest(Compiled
Code)
at
com.putnaminvestments.common.jato.ApplicationServletBase.doPost(Compi
led Code)
at
com.putnaminvestments.common.jato.ApplicationServletBase.doGet(Compil
ed Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at com.putnaminvestments.bp.bpServletBase.service(Compiled
Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at
com.netscape.server.servlet.servletrunner.ServletInfo.service(Compile
d Code)
at
com.netscape.server.servlet.servletrunner.ServletRunner.execute(Compi
led Code)
at com.kivasoft.applogic.AppLogic.execute(Compiled Code)
at com.kivasoft.applogic.AppLogic.execute(Compiled Code)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at com.kivasoft.thread.ThreadBasic.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)
--- In iPlanet-JATO@y..., "Todd Fast" <Todd.Fast@S...> wrote:
Mark--
Initially we tried to add the pageAttributes NVP as well, but that
was
causing an exception, so we stopped doing that.That's odd--what was the exception?
Our problem now is that when the SessionTimes out it does not go
to
onSessionTimeout method as in processRequestMethod of the
ApplicationServletBase it looks for pageAttributes. If it is notnull
then only onSessionTimeOut method is called.This is sadly the only technique for determining if a session hastimed out
and a new one been created, versus the initial creation of thesession.
Is there any work around for this? Maybe you can suggest how topass
the pageAttributes without causing the initial exception?Definitely--let me know what the exception was and I'll be able tosuggest
something. However, it shouldn't really be any harder thanappending a
"jato.pageAttributes=" empty NVP on the HREF.
Todd
Todd Fast
Senior Engineer
Sun/Netscape Alliance
todd.fast@s...
For more information about JATO, please visit:
http://developer.iplanet.com/tech/appserver/framework/index.jspOK, here's what I'm trying to do: We have, like you said, a menu
page. The pages that it goes to and the number of links are all
variable and read from the database. In NetD we were able to create
URLs in the form
pgXYZ?SPIDERSESSION=abcd
so this is what I'm trying to replicate here. So the URL that works
is
pgContactUs?GXHC_GX_jst=fc7b7e61662d6164&GXHC_gx_session_id_=cc9c6dfa5
601afa7
which I interpreted to be the equivalent of the old Netd way. Our
javascript also loads other frames of the page in the same manner.
And I believe the URL-rewritten frame sources of a frameset look like
this too.
This all worked except for the timeout problem. In theory we could
rewrite all URLs to go to a handler, but that would be...
inconvenient. -
JInternalFrame not opening in JAR file, but works when not in JAR
I have a folder that contains multiple .class files. I make all the class files into one jar file with this command:
jar cmf mainClass.txt myapplication.jar *.class
The mainClass.txt contains the following:
Main-Class: myapplication
class-path: myapplication.jar
The myapplication.class opens up a JDesktopPane inside a JFrame. It also contains a start menu, which again has elements that opens up misc JInternalFrames inside the JDesktopPane. The problem is this:
When I run the application from a .bat file, everything works fine. However, after making the JAR Executable file, everything works except 1 JInternalFrame. Now, the code for this JInternalFrame is far too much to post, so I'll have to ask as follows;
Are there any reason why a JInternalFrame would not work from inside a JAR Executable, but work when not in the JAR file? Especially when other JInternalFrames are working? What can make 1 JInternalFrame different from the others in this regard?Perhaps the problem lies somewhere else.
Obviously if other JInternalFrames are working then there is a difference in the one missing internal frame that causes it not to show up.
My guess is that perhaps you are missing one or two classes in your JAR that are used by that JInternalFrame and that an exception is being thrown causing it not to show.
Double check the contents of your JAR and make sure that all the classes are present and that they are the right versions. -
Should I turn off my Mac Pro when not in use or leave it running?
I have been told I should never turn off my computer by some people, and others say that I should always turn it off when not in use! I use my Mac Pro primarily for music recording/editing in my home studio or word processing. Now that I have an iPad I use that for web browsing, email, FBing, etc. and I find myself on my Mac Pro a lot less. I get the basis behind both trains of thought; those who leave it on feel always stopping and starting up puts unnecessary wear on the moving disks, and those who shut down think if the parts are always moving they are bound to wear out faster. I am not as concerned with conserving power as I am with keeping my machine safe! If you have any information on this topic I would love to hear it. Thanks!
Providing you have a robust firewal and are not worried as a result about being hacked then leave it turned on and allow it to sleep. Make sure you allow the screen to sleep as well a that is the item that is more prone to damage by being left on all the time.
I never turn my machine off, never have with any of my Macs ever since my first one back in 1979-ish and have never suffered any adverse affects. Today, the power drain is so small when allowed to sleep that I doubt they would offend even the ardent 'turn off everything and pull out the plug to save the planet' person.
If you have an iPad or iPod synced with the Mac for email and iCal and address Book etc. then if you leave it on it should be up to date as soon as you return home, mine is anyway. With iCloud coming out very soon that may come into play even more so with all its advance pushing etc. Just a thought.
One advantage in leaving the machine on (sleep) is that you can access it from anywhere in the world should the need arise with the appropriate settings, which you can't if you turn it off.
Leave it on. -
How do I turn off background ni file activity when not using Labview? I use labview rarely, and I also use my computer for demanding multimedia applications, including multitrack digital audio recording. I need to reduce as much background activity as possible, and taking a look with task manager I see files such as nimxs.exe, nipalsm.exe, nipalsm.exe, nisvcloc.exe, and nicitdl5.exe running even when I haven't used Labview (8 I believe). These files run even after I right click the NI icon on the lower right and turn off the application. I would like the computer to boot up without these files, and for the necessary files to be activated only when I start the program.
Can this be done or do I have to remove labview from the system to improve performance?
ThanksHello, those processes are part of running NI services that start when Windows boots. These processes serve varied purposes and stopping them can have undefined and unknown consiquences for your NI products. These products run at "normal" priority meaning that they should be preempted by any process running at a higher priority which I would expect your other application to be doing given their time sensitivity. That being said, in Windows XP (I can't speak for other OSes), you can lower their priorities even greater through task manager (right click the process»set priority) to further remove them from contention for resources. If you want to prevent them from running you can set the service startup type to "manual" in Control Panel»Administrative Tools»Services. Right click the process go to Properties and Under the General tab choose Startup Type»Manual. This will start up the processes only when something directly starts it up. LabVIEW will start these processes up as it attempts to use them. When you shut down LabVIEW you will need to manually shut down these processes through task manager. Again, doing this can cause problems with your NI products on your system and it is not advised.
Travis M
LabVIEW R&D
National Instruments -
NoClassDefFoundError when trying to return a custom Object
Hi,
I'm trying to get some system memory info from a Windows machine using Java. I've written the C code and Java code and it all compiles fine. I can also use most of the methods in the two files. I have a problem with one method though. Its a method that is returning an object type that I created that mirrors a windows structure. Below is the code.
// Java Object to store the data
package agent.win32;
public class MemoryInfo{
int dwLength;
int dwMemoryLoad;
int dwTotalPhys;
int dwAvailPhys;
int dwTotalPageFile;
int dwAvailPageFile;
int dwTotalVirtual;
int dwAvailVirtual;
public int get_dwLength() { return dwLength; }
public int get_dwMemoryLoad() { return dwMemoryLoad; }
public int get_dwTotalPhys() { return dwTotalPhys; }
public int get_dwAvailPhys() { return dwAvailPhys; }
public int get_dwTotalPageFile() { return dwTotalPageFile; }
public int get_dwAvailPageFile() { return dwAvailPageFile; }
public int get_dwTotalVirtual() { return dwTotalVirtual; }
public int get_dwAvailVirtual() { return dwAvailVirtual; }
// Java Class that uses JNI
package agent.win32;
public class NIMSNT {
//Constructor
public NIMSNT(){};
static{
try{
System.loadLibrary("NIMSNT");
catch (java.lang.UnsatisfiedLinkError e) {
System.out.println (e);
* check psapi.dll and psapi functions
* return true if NT process can be enumerate
public static native boolean Initialize();
* Description:The EnumProcesses function retrieves the process identifier
* for each process object in the system
* return value:the list of process identifiers
* call psapi function EnumProcesses
public static native int[] EnumProcesses();
* Description:The OpenProcess function returns a handle to an existing process object.
* return value:If the function succeeds, the return value is an open handle to the specified process
* call kernel32 function OpenProcess
public static native int OpenProcess(int Pid);
* Description:The EnumProcessModules function retrieves a handle for each module in the specified process
* return value:the list of module handles
* call psapi function EnumProcessModules
public static native int[] EnumProcessModules(int hProcess);
* Description:The GetModuleFileNameEx function retrieves the fully qualified path for the specified module
* return value:the fully qualified path for the specified module
* call psapi function GetModuleFileNameEx
public static native String GetModuleFileName(int hProcess,int hModule);
* Description:The GetModuleBaseName function retrieves the base name of the specified module
* return value:the base name of the specified module
* call psapi function GetModuleBaseName
public static native String GetModuleBaseName(int hProcess,int hModule);
* Description:function closes an open object handle
* return value:true if succesfuly
* call kernel32 function CloseHandle
public static native boolean CloseHandle(int handle);
* Description:function gets system memory
* return value:String
public static native MemoryInfo GetSystemMemoryInfo();
// C Structure (defined in windows.h)
typedef struct _MEMORYSTATUS {
DWORD dwLength;
DWORD dwMemoryLoad;
SIZE_T dwTotalPhys;
SIZE_T dwAvailPhys;
SIZE_T dwTotalPageFile;
SIZE_T dwAvailPageFile;
SIZE_T dwTotalVirtual;
SIZE_T dwAvailVirtual;
} MEMORYSTATUS, *LPMEMORYSTATUS;
// C code
#include <windows.h>
#include <string.h>
#include "agent_win32_NIMSNT.h"
#define MaxProcessNumber 10000
/** Type Definitions **/
typedef BOOL (WINAPI *ENUMPROCESSES)(
DWORD * lpidProcess,
DWORD cb,
DWORD * cbNeeded
typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
HANDLE hProcess,
HMODULE * lphModule,
DWORD cb,
LPDWORD lpcbNeeded
typedef DWORD (WINAPI *GETMODULEFILENAMEEXA)(
HANDLE hProcess,
HMODULE hModule,
LPTSTR lpstrFileName,
DWORD nSize
typedef DWORD (WINAPI *GETMODULEBASENAME)(
HANDLE hProcess,
HMODULE hModule,
LPTSTR lpstrFileName,
DWORD nSize
typedef struct _PROCESS_MEMORY_COUNTERS {
DWORD cb;
DWORD PageFaultCount;
DWORD PeakWorkingSetSize;
DWORD WorkingSetSize;
DWORD QuotaPeakPagedPoolUsage;
DWORD QuotaPagedPoolUsage;
DWORD QuotaPeakNonPagedPoolUsage;
DWORD QuotaNonPagedPoolUsage;
DWORD PagefileUsage;
DWORD PeakPagefileUsage;
} PROCESS_MEMORY_COUNTERS, *PPROCESS_MEMORY_COUNTERS;
typedef BOOL (WINAPI *GETPROCESSMEMORYINFO)(
HANDLE hProcess,
PPROCESS_MEMORY_COUNTERS ppsmenCounters,
DWORD cb
/** Global Variables **/
ENUMPROCESSES EnumProcesses;
ENUMPROCESSMODULES EnumProcessModules;
GETMODULEFILENAMEEXA GetModuleFileNameExA;
GETMODULEBASENAME GetModuleBaseName;
GETPROCESSMEMORYINFO GetProcessMemoryInfo;
/** DLL Entry **/
BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved){
return TRUE;
* Class: nims4_agent_win32_NIMSNT
* Method: Initialize
* Signature: ()Z
JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_Initialize(JNIEnv * env,jclass clazz){
HANDLE hpsapi=LoadLibrary("PSAPI.DLL");
if (hpsapi==NULL) return FALSE;
EnumProcesses=(ENUMPROCESSES)GetProcAddress((HINSTANCE)hpsapi,"EnumProcesses");
GetModuleFileNameExA = (GETMODULEFILENAMEEXA)GetProcAddress((HINSTANCE)hpsapi, "GetModuleFileNameExA");
GetModuleBaseName = (GETMODULEBASENAME)GetProcAddress((HINSTANCE)hpsapi, "GetModuleBaseNameA");
EnumProcessModules = (ENUMPROCESSMODULES)GetProcAddress((HINSTANCE)hpsapi, "EnumProcessModules");
GetProcessMemoryInfo = (GETPROCESSMEMORYINFO)GetProcAddress((HINSTANCE)hpsapi, "GetProcessMemoryInfo");
if (
NULL == EnumProcesses ||
NULL == GetModuleFileName ||
NULL == GetModuleBaseName ||
NULL == EnumProcessModules )
return FALSE;
return TRUE;
* Class: nims4_agent_win32_NIMSNT
* Method: EnumProcesses
* Signature: ()[I
JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcesses(JNIEnv * env, jclass clazz){
DWORD aPids[MaxProcessNumber];
DWORD cGot;
jintArray Pids=0;
if(EnumProcesses(aPids,sizeof(aPids),&cGot)){
cGot /= sizeof(aPids[0]);
Pids= (*env)->NewIntArray(env,cGot);
(*env)->SetIntArrayRegion(env,Pids,0,cGot,(jint*) aPids);
return Pids;
* Class: nims4_agent_win32_NIMSNT
* Method: OpenProcess
* Signature: (IZI)I
JNIEXPORT jint JNICALL Java_agent_win32_NIMSNT_OpenProcess (JNIEnv * env, jclass clazz,jint Pid){
return (jint) OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,Pid);
* Class: nims4_agent_win32_NIMSNT
* Method: EnumProcessModules
* Signature: (I[I)[I
JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcessModules (JNIEnv * env, jclass clazz, jint hProcess){
HMODULE hModule[MaxProcessNumber];
jintArray jModule=0;
DWORD cGot;
if (EnumProcessModules((HANDLE)hProcess,hModule,sizeof(hModule),&cGot)){
cGot/= sizeof(hModule[0]);
jModule= (*env)->NewIntArray(env,cGot);
(*env)->SetIntArrayRegion(env,jModule,0,cGot,(jint*)hModule);
return jModule;
* Class: nims4_agent_win32_NIMSNT
* Method: GetModuleFileName
* Signature: (II)Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleFileName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
jstring jName=0;
char FileName[MAX_PATH];
if(GetModuleFileNameExA((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
jName=(*env)->NewStringUTF(env,FileName);
return jName;
* Class: nims4_agent_win32_NIMSNT
* Method: GetModuleBaseName
* Signature: (II)Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleBaseName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
jstring jName=0;
char FileName[MAX_PATH];
if(GetModuleBaseName((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
jName=(*env)->NewStringUTF(env,FileName);
return jName;
* Class: nims4_agent_win32_NIMSNT
* Method: CloseHandle
* Signature: (I)Z
JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_CloseHandle(JNIEnv * env, jclass clazz, jint handle)
return CloseHandle((HANDLE) handle);
* Class: nims_agent_win32_NIMSNT
* Method: GetSystemMemoryInfo
* Signature: (I)Lagent/win32/MemoryInfo;
JNIEXPORT jobject JNICALL Java_agent_win32_NIMSNT_GetSystemMemoryInfo(JNIEnv * env, jclass clazz){
jfieldID jfield;
jobject jobj=0;
MEMORYSTATUS stat;
stat.dwLength = sizeof(stat);
GlobalMemoryStatus(&stat);
clazz=(*env)->FindClass(env,"agent.win32.NIMSMemoryInfo");
if (clazz==0) return 0;
jobj = (*env)->AllocObject (env,clazz);
//set NIMSMemoryInfo object field
// dwLength
jfield=(*env)->GetFieldID(env,clazz,"dwLength","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwLength);
// dwMemoryLoad
jfield=(*env)->GetFieldID(env,clazz,"dwMemoryLoad","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwMemoryLoad);
// dwTotalPhys
jfield=(*env)->GetFieldID(env,clazz,"dwTotalPhys","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwTotalPhys);
// dwAvailPhys
jfield=(*env)->GetFieldID(env,clazz,"dwAvailPhys","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwAvailPhys);
// dwTotalPageFile
jfield=(*env)->GetFieldID(env,clazz,"dwTotalPageFile","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwTotalPageFile);
// dwAvailPageFile
jfield=(*env)->GetFieldID(env,clazz,"dwAvailPageFile","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwAvailPageFile);
// dwTotalVirtual
jfield=(*env)->GetFieldID(env,clazz,"dwTotalVirtual","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwTotalVirtual);
// dwAvailVirtual
jfield=(*env)->GetFieldID(env,clazz,"dwAvailVirtual","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwAvailVirtual);
return jobj;
};I can use all of the methods in the Java/C code except for the the last native method public static native MemoryInfo GetSystemMemoryInfo(); . I get a NoClassDefFoundError when I try to use this method. I have a feeling that I'm just doing something stupid.
Thanks in advance,
JohnYes, exactly. I changed the name of that class and forgot to change it in the c code. Thanks for the feedback.
Also, if anyone is using this code as an example, you need to change "agent.win32.MemoryInfo" to "agent/win32/MemoryInfo" in the c code. If it is left as "agent.win32.MemoryInfo" you will get a ClassCircularityError when trying to make multiple calls to the NIMSNT.GetSystemMemoryInfo();. -
Get error message: "Element 'when' not found in 'xsl:choose'"
Thank you in advance for your help.
I got this error message:
Caused by: oracle.xdo.parser.v2.XMLParseException: Element 'when' not found in 'xsl:choose'.
When I put a form field with this help text:
<?CHOOSE:?><?WHEN:ELMT_CATEGORY_CODE='SS'?>
Did some research but cannot find why...
-BillNever mind, put the <?end choose?> in wrong position. Thanks
-
Why would my iPod show a full battery when connected to power but when not connected it will no longer turn on
For both
Try:
- iOS: Not responding or does not turn on
- Also try DFU mode after try recovery mode
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
- If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
- Try on another computer
- If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
Apple Retail Store - Genius Bar -
I have downloaded all my music from the cloud to my new iPhone and created playlists so I can listen to it when not it wifi like when on a plane. If I turn on iTunes Match will I still have this music still downloaded? The online information suggests all my music will be replaced. Will I have to download it again??
What you have on your computer is your iTunes library, not an iTunes "account." The account that is related to iTunes is your Apple ID, which you use to sign in to the iTunes Store and make purchases. It is also used with iCloud. iPods (that are not iPod touch) are associated with your iTunes library, not to your Apple ID.
So, I think you probably just need to set up (or update) automatic syncing for the iPod. If it's not set up to sync those new songs, iTunes still syncs the iPod, but it syncs nothing
In iTunes, if the sidebar (along left side of iTunes window) is hidden, from the menu bar, under View, select Show Sidebar. In the sidebar, the iPod appears under DEVICES, when it is connected.
Select the iPod in iTunes. There is a row of buttons, starting with Summary. Click on Music next to Summary. This is the iPod's Music screen, where you tell iTunes how to sync songs to the iPod.
Check the box for Sync Music (if it's not already checked). If your iTunes music library fits completely on the iPod, you can choose to sync Entire music library. Otherwise, you can choose to sync Selected playlists, artists, albums, and genres. On the lists below, checkmark the playlists, artists, albums, and/or genres that you want on the iPod. When you click Apply, the songs from your selection sync to the iPod.
One convenient way to set this up (if you can't sync the entire iTunes music library) is to create a new playlist in your iTunes library. Name it "iPod Songs" (or whatever you want). Put ALL songs that you want on the iPod on this playlist, including those new songs. Back on the iPod's Music screen in iTunes, select this playlist under Playlists. Going forward, to update songs on the iPod, just update that playlist in your iTunes library (add/remove songs). The next time you connect the iPod (or click the Sync button), iTunes automatically syncs the same changes to the iPod. -
How do I keep an application window hidden when not accessed?
I have an application running constantly to control my FW audio interface outputs etc. I use system events applescripts to control it's UI with a USB controller (PowerMate) - and that by necessity brings the application window to the front every time accessed. That's fine.
But I want to have a script that hides this application window when it's not used after 2 seconds. Maybe there is an "on idle" script that could run to check if that window is visible. I imagine something including lines like this:
-- a routine that checks if the window is visible every 2 seconds or so.
-- the window reference
window "Studio Monitor Express" of application process "Studio Monitor Express"
-- if it is, then hide it
-- for hiding the window/app
keystroke "h" using command down
-- if it's not, then ignore
I'm not sure whether to use system events or finder events etc. I have a bunch of other apps running obviously, but I just want this particular window to disappear when not needed.I solved it. I know. Easy:
on idle
tell application "System Events"
set visible of process "Studio Monitor Express" to false
end tell
return 2
end idle -
I just got the 5G Airport Extreme base station. Set-up was a snap! Maybe 10-15 minutes compared to a friend who got another name brand for his pc and took a couple hours, even having to call customer support! Been working great so far, but am concerned about never turning it off, not only about the possibe harm that could be done to the unit, but also about having an active, open Internet connection 24/7. Before I got my Airport Extreme I was using Ethernet cable with a cable modem that could be placed on "standby" whenever I was not using my Mac for Internet, but since AE5G doesn't have a power switch on the unit, have left it turned on rather than unplugging it by the electrical cord. I did turn AirPort "off" in the menu bar when not using it wth my Mac, but AE is still apparently constantly active, showing a steady green light. Would there be any harm done by plugging it in only when I want to use Wi-Fi, then unplugging it?
Thanks for the help!Would there be any harm done by plugging it in only when I want to use Wi-Fi, then unplugging it?
That is a matter of debate, since there are two schools of thought regarding power status on a router.
One school maintains that you can turn the device on and off as needed. Makes sense for some folks. The advantage of this is that it might save a bit of electricity, although the Extreme draws very little power most of the time.
Another school believes that there is a reason why Apple did not even place an "Off" switch on the device. It's designed to run 24/7.
Leaving the Extreme on will place far less stress on the electrical components in the device since they stay in an "idle" state most of the time, drawing very little current. Powering any electrical device up sends a sudden rush of current through the device, which places far more stress on a device than if it is simply left on.
It depends on your priorities. If you want to save electricity, your decision is already made. If you intend to prolong the life of the router, then consider leaving it on, as Apple intended.
A compromise position might be to leave the Extreme on most of the time and power if off for long weekends or vacation periods when you will be away. Remember that the Extreme must establish all new network connections every time that it powers back up....perhaps another reason to simply leave it on.
Maybe you are looking for
-
How can i copy text from a pdf while in firefox?
i no longer seem to be able to highlight and copy text from a pdf, while in firefox 33.0, using adobe to view pdfs. how do i turn on the select tool, so i can do this?
-
I am Australian and going to Canada. Hoping to take my MacBook and connect to wi-fi services there. Do I need to set anything up on the computer before I go. It has built in AirPort Extreme (802.11n). Can I just go and click safari when there and up
-
I remember reading in one thread or another that one of the USB ports puts more power than the others. I think someone was trying to address why their external BUS powered USB HDD wasn't working. Someone suggested switching USB ports because of the p
-
Can anyone get my skype name from anywhere in the ...
i have had a chap on my skype from florida america, i asked how he managed to get my name, he said he has just joined skype and picked my name out, could you please tell me how he managed to get my name
-
Hi, I created simple mobile application in Flash Builder 4.5 Trial edition, but I have a problem with export to the my Android tablet (Samsung galaxy tab). In menu - Export release builder in first window I choose - in combobox I selected my project