Windows 7 - JAVA - starting or stopping apache 2 (httpd) service - java

I would like to know how to stop, start, and restarting the Apache (2.0.64) service installed under Windows 7 in my program JAVA (executed in the same machine).
Initially, I developed my apps in Linux environment and I had no problem to do that. Now, I'm migrating in Windows 7, and I can't do it. I have an error message like : "(OS 5)Access denied. : failed to open Apache2 service".
At the beginning, I thought that error is due to the fact that my account system doesn't have enough rights to do so. I tried to change proprietary of folder c:\Program Files(x86)\Apache2, and in Services (open session as my account). It still no working and I get the same message every time.
I need absolutely to control Apache2 process.
If anyone have any ideas that could help me?
Thank you.

One more strange stuff of Windows ....
I figured out why my apps in JAVA didn't work in Windows 7 environment. It juste because since Windows Vista, MS tries to hide the "popup flooding" stuff with something called "UAC - User Account Control".
And in the default configuration, whatever you do; change proprietary of files or services, you still execute them in "limited user" so you don't have trace, you don't know why your programs don't work properly, and you can't even debug it ...
So, if you want to execute an exec stuff in Windows that was installed as "Administrator" role from you apps (Java in my case) , you must play with levels that provide UAC and restart your computer to take effect of that modification.
For me, i set i to the lowess level and it work. I remarked that when i do "Windows"+R, i have a message like "This task's going to be executed as admnistrator privileges"... OK
In short, when you develop with Windows you must debug Windows first, then your apps
....
Welcome to Windows and long life Linux !

Related

Unable to see networked drive on Windows 10 PC using Java Open Dialog in IDE but see it outside of IDE

Why am I unable to see networked drive on Windows 10 PC with Java Open Dialog. I have noticed a problem when running my Java application from IDE, the Open Dialog does not show my NAS (NetGear ReadyDuo mounted on Z:drive). Yet when I run the application outside of the IDE on the same machine using the same JVM it is okay.
In both cases I'm using Java 1.8.0_72 25.72-b15 64bit on Windows 10 10.0 amd64. I'm sure I didn't used to have this issue but don't know when it started occurring. Its not such a big issue for me if it doesn't show in the IDE because of the IDE, but I'm concerned the IDE may be irrelevant and that potential customers are also seeing this behaviour.
Screenshots below show what I see in the two circumstances
I have encountered this behaviour in other softwares, where the cause was, that the drive was not mapped persistent.
What i did to solve it:
Map your Network Drive with the Windows Explorer GUI and mark "always connect".
or in cmd.exe (please try above 1st!):
net use z: \nas\media /user:usr pass /persistent:yes
Kind regards.
Its not possible for me to comment, so I have to ask here.
Did you tried to run your IDE with Administrator Rights? Maybe some minor 'problems' with UAC (User Account Control).
Solved issue, it seems if you mount a network drive using Windows Explorer, but then run the IDE with administrator privileges then you do not have permission to access the drive because now seen as separate user admin (even though I only have a single user) that wasn't given permission.
The way round is write create batch file to mount the network drive
i.e
net use z: \\nas\media /persistent:yes
and then right click on the batch file and select Run as Administrator
Don't know if there is an easier way.

Java ME SDK 3.2 (and 3.3, 3.0 as well) just won't start

When i try to launch it any way, Java ME just freezes. To be more specific, javaw.exe called by device-manager.exe seems to go into infinite loop, since not a single exception or error message is passed. Icon in tray appears, but its menu, instead of devices list, shows only one entry: Exit, which incidentally doesn't work. I can only shutdown it through task manager. And since device-manager is required for emulator, i can't work with it at all.
I tried versions 3.0,3.2,3.3 of Java ME SDK and this problem persists in each one. OS: Windows 7. JDK: 7u25.
I've tried each and every advice i found on the Internet and still can't get it working. Device-manager log shows that the problem starts upon calling "rmiRegistryPortFile".
[2013-07-02 19:20:53.070] DEBUG - strap.BasicObjectConfiguration - Calling create on rmiRegistryPortFile
That's always the last entry in the log.
There was only one way i've managed to get it working - by installing and running it under Windows Virtual PC. Curious thing is, under VM it's working fine in the same very OS (freshly installed Windows 7). But unfortunately that didn't really give much on the cause of the bug, and that's not a solution :( I have to somehow get it working without VM.
I tried reinstalling Windows, that didn't help. Looked through javaw I/O in Process Monitor and compared it with working one. It looks like one of the application threads suddenly shuts down after reading file "rt.jar" (when loading "rmiRegistryPortFile" i guess?), whereas working javaw writes to log-file immediately after that. Windows logs got nothing on the subject: no permission issues, no errors or warnings at the time.
Tried modifying PATH variable to the dir with rmiregistry.exe, did not help. Network sockets are available. Changed DEP settings, same.
Could anyone please help? I've spent days on this bug already.
It's definitely a permission problem. Try to look if any folder related to Java is "READ ONLY".
If you get this error message when trying to run midlets through the built-in emulator of the JavaME SDK 3.0, try disabling DEP for runMidlet.exe.
Data Execution Prevention (DEP) configuration can be found at the following place in Windows: Control Panel > System Security > System > Advanced system Settings > Advanced tab > Performance > Data Execution Prevention.
Add this file to the DEP exclusion list:
<javame-install-dir>\runtimes\cldc-hi-javafx\bin\runMidlet.exe
If things work for you now, complain loudly to Sun (now Oracle) that they need to make software without buffer overflows.
Personally I filed a bug-report against the JavaME SDK 3.0. You should do that too, or make your voice heard on the same bug-report that you're having this problem as well.
Freshly installed windows doesn't have msvcrtXX.dlls
Go to folder runtimes\\cdc-hi\\bin and copy Microsoft.VC80.CRT into runtimes\\cldc-hi-javafx\\bin. This problem will be fixed over autoupdate soon.
Problem with localhost
Please edit <javamesdk_installdir>\\toolkit-lib\\modules\\bootstrap\\conf\\system.properties and change
device-manager.object-registry.host=localhost to: device-manager.object-registry.host=127.0.0.1
Port 1299 might be taken
Please edit <javamesdk_installdir>\\toolkit-lib\\modules\\bootstrap\\conf\\system.properties and change
device-manager.object-registry.port=1299 to: device-manager.object-registry.port=1999
XP 64-bit
Please use 32-bit version of JDK.
Firewall
Make sure that firewall is not blocking communication on ports given in 3. Default port numbers are 1299 for windows and 1999 for Mac.
I have tried all those steps above to no avail, until I replaced my JDK jdk-8u117 with jdk-8u112 (Must be 32 bit) after reading this thread https://community.oracle.com/thread/4009110. I had to restart my machine after changing the Java version because it was not detecting right away after installation. I'm using Netbeans 7.4.

Webstart App on Windows 7 JNLP File Disappears

We are in the process of verifying one of our web start applications on Windows 7 as that is what our enterprise is moving to.
We are seeing the strangest thing. When a user runs the application while connected to our network over VPN, the application downloads and runs properly.
However, immediately upon disconnecting from VPN, the jnlp file is removed from the Java cache and subsequent attempts to run the application via desktop shortcut fail as the jnlp file in the cache (referenced in the shortcut) is missing.
We have also seen that at times when the user reboots, the application is completely gone from the java cache, no jar files at all, as though it were never installed.
Does anyone know what is going on here? Does it have to do with the new LocalLow security stuff in Windows 7?
Thanks in advance for any help. We are at the point with this where we may abandon Web Start entirely if we can't resolve.

Java service wrapper to create service for Java UI application

I have created a Java application which needs to run as a service. For service wrapper I tried using tanuki and other wrapper softwares.
Now, my application does run as a service - however, it runs as a service under SYSTEM and not under currently logged in user.
My application has a UI, which does not show when the application is running as a service. I doubt that this has happened because the service is running under SYSTEM and not under currently logged in user.
When I run the application (without installing it as a service), the UI does show up and I could see the java process running under the current user's id, whereas it runs under SYSTEM when installed as a service.
Now, there is nothing to my application if there is no UI. I need to application to run as a service when the system boots up and the UI needs to show up as well.
Has anyone tried to do what I am doing here and has faced a similar issue. If so, how did you go about resolving it?
Is there a different wrapper service that I could use and not have this issue.
Tanuki's documentation does explain setting a java application as a service, but does not talk about a java applicaiton with a UI and running it under the currently logged in user.
Update
Just so that folks here could get a bit more idea as to what is it that I am trying to accomplish - the behavior that I am trying to have with my app is similar to how Dropbox or Yahoo Messenger or any other software has which starts with Windows boot and continues to run in the background, allowing the users to interact with it using the system tray icon. So basically all of this has been built in Java/Swing. Now when it has come to deployment of the app - I can run it standalone but running the jar file or by creating and running an executable wrapper for it. However, I want the software to start with Windows boot and continue to run as a service in the background, while allowing the user to make changes and interact with it via lets say bringing up the UI from a system tray icon that it sets.
As of now, it does run as a service successfully. It performs all the actions that it ideally should - there just is no system tray icon to bring up the UI and make changes to its configuration.
Update - 2
Ok.. I tried advanced installer and it does wrap up everything for me to generate an exe installer for windows. Now all I need is to auto-start the software. Can anyone help me with this? I don't see an option in Advanced installer to automatically have the program add itself up in the auto-start.
Link to tanuki's doc http://wrapper.tanukisoftware.com/doc/english/faq.html
Rohan,
Please take a look at the following page:
http://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html
You will need to mark the Service as interactive and then run as the SYSTEM user in order to get your GUI to show up on the first logged in desktop.
The problem is that Microsoft changed what services are allowed to do starting with Windows 2008 and Vista. This means that starting with these versions, the GUI will always show up on a sandboxed desktop which the user will need to switch over to.
If you want to show a GUI on all desktops, in all versions of Windows, you will need to run the JVM within the desktop.
Cheers,
Leif
I wanted to comment on your question, but I don't have enough reputation to do it. So I'm misusing the answer function now.
I have a similar problem. I used the tanuki wrapper for a while now on a Windows XP machine and the Swing GUI was shown to all users who logged in.
Now I migrated to Windows 2008 Server and configured the current version of the tanuki wrapper like this:
wrapper.ntservice.interactive=true
wrapper.ntservice.hide_console=true
(see documentation here and here)
The Windows service runs under the LOCAL SYSTEM account.
But the GUI is still not shown. Did you find any solution to the problem?
Don't think you should have a UI with a service. Put it in the startup group instead ?
What's does the UI and application do?

winapi - logonUser not supported

i desperate.
my applications run as windows service, and it needs to create new regular process with different credentials.
it should run under win nt, xp, 7, etc.
because it runs as a service, i have to use the logonUser and CreateProcessAsUser win api functions (and not CreateProcessWithLogon).
on win 7 + win 2003 server it works perfect, but on win xp i got error code 50 while invoking "logonUser" ("the request is not supported").
i tried to play around with the local security policy, but it didn't work.
any suggestions?
(i invoke logonUser with default provider flag (0) and logon interactively (2)).
EDIT:
the problem is probably not windows xp. i run the same code on other win xp machine, and it worked. so, it is problably specific configuration on specific machine.
maybe the i changed some configurations while i was playing with previous problems (http://stackoverflow.com/questions/6898361/createprocessasuser-win-api-is-not-working-on-non-win7-platforms)
therefore, maybe my question should be: what configuration can effect the logonUser function, so the error message "The request is not supported" can be raised?
p.s.
i cant be sure that logonUser was successfully completed before, but i think it does.

Categories

Resources