Can we use Java (included JNA) to change Windows proxy settings (System level, not just for JVM) on the fly. I found some code snippets for C# where they are using InternetSetOption() API provided by wininte.dll. I've tried but it does not work also. All I want is to change IE and Chrome proxy settings by running a JAR file (desktop app) without restarting the browser.
Thank you so much!
Related
I am writing a java application, which can handle standard links (http/https).
How can I register my application as the default program opening these links (aka default browser) in Windows 10?
I know I can select the default browser in the windows settings, but it only shows a limited list, no way to hook up a custom program.
I've found this, but it only shows how to do it pre-win10, plus I'm not sure it can be done in java.
The application needs to be packaged as an exe.
I used launch4j for this. Make sure textVersion and icon is set.
A lot of registry keys need to be created. I've pieced those together by looking at this post (kindly linked by #Tarun Lalwani), this post, and the registry entries created by firefox. This means some of them might not be necessary.
Register client
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\Capabilities]
'ApplicationDescription'='MyApp'
'ApplicationIcon'='C:\MyApp\MyApp.exe,0'
'ApplicationName'='MyApp'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\Capabilities\URLAssociations]
'http'='MyAppURL'
'https'='MyAppURL'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\DefaultIcon]
#='C:\MyApp\MyApp.exe,0'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\shell\open\command]
#='C:\MyApp\MyApp.exe'
Register url handler
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL]
#='MyApp Document'
'EditFlags'=0x2
'FriendlyTypeName'='MyApp Document'
'URL Protocol'=''
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\DefaultIcon]
#='C:\MyApp\MyApp.exe,0'
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\shell]
#='open'
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\shell\open\command]
#='"C:\MyApp\MyApp.exe" --url "%1"'
Register to default programs
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
'MyApp'='Software\Clients\StartMenuInternet\MyApp\Capabilities'
Now the application can be selected in the windows settings
I'm trying to use the auto-update feature of install4j. The updater is configured as stand-alone and is launched by the user from a menu item with the code snippet from the installer configuration. The updates.xml URL is configured in the Auto-Update Options screen.
The updater is started correctly but then it fails with the error "The update information could not be downloaded from ". The URL is correct and the xml file can be viewed from a web browser on the same client computer. I tried disabling the firewall and antivirus, but nothing has changed.
I use install4j version 6.1.6 and the target platform is Windows (tested on Win7 and WinXP just in case).
Can anyone suggest a possible reason for this failure and/or a way to get more diagnostic information?
Thanks in advance
Sasha
I solved the problem by disabling browser integrity check in the CloudFlare settings. This means that install4j is sending malformed HTTP headers that are interpreted by the CloudFlare firewall as suspicious.
I do hope that this install4j bug will be fixed, since allowing access at the CloudFlare level means that the server is more exposed to actual threats.
I have create a download manager like IDM and I want to install chrome extension.
As you see when you install IDM it automatically add chrome extension in it.
I want to do it like that whenever mine Downloader install it will automatically add chrome extension same as IDM.
I'm new in software development so, how to do that I'm using java programming.
I checked IDM folder and found .crx file which mean this is chrome extension.
And I think IDM load extension from this folder to chrome.
But according to my search Google disable to install chrome extension out of Chrome web store then how IDM do it.
Any suggestion which things I need to do that ?
UPDATE:
I try to install it using preference JSON but its not working.
I followed a method which is described here.
please check out this link.
After facing a same problem, I found this Google article which will help you to Load Chrome extension from outside.
An extension that is not installed from the Chrome Web Store is known as an external extension. For developers who want to distribute an extension as part of the installation process for other software, or for network admins that want to distribute an extension throughout their organization, Google Chrome supports the following extension installation methods:
Using a preferences JSON file (for Mac OS X and Linux only) Using the
Windows registry (for Windows only) Both ways support installing an
extension hosted at an update_URL. On Windows and Mac, the update_URL
must point to the Chrome Web Store where the extension must be hosted.
I want to launch a exe file when click on the button from my appliction and that should be from client machine. I tried with following solutions.
Runtime.getRuntime().exec(".....\\somefile.exe");
when I follows the above solution then it was opened server machine exe file.
I applied one more solution in script code
i.e
**var ws = new ActiveXObject("WScript.Shell");
ws.Exec("...\\somefile.exe");**
the above code working fine but I need to enable ActiveX related script enble mode in client browser window manually and it is only applied for IE only.
Let me know any solution that is browser independent and without activex enable option.
How we can open browser through Java ME code in ubuntu os ?
I am using the below given code
String URL1="any url";
midlet.platformRequest(URL1);
The above line does not open the browser in the UBUNTU 10.10 but its working fine on windows os.
Please help me if any body else have faced the same problem.
if you use emulator (which one?), check if it is properly configured (emulators tend to have stuff like that in User Guide y'know)
eg this article provides a recipe for WTK / ME SDK:
...The J2ME Wireless Toolkit supports the platformRequest() method, but
before using the method you must tell the toolkit what to do when it's
invoked. You can associate only one platform service with
platformRequest(). For instance, if for testing purposes you associate
the method with your browser, the browser will be launched every time
you call platformRequest(). If you need more flexibility, you can
associate platformRequest() with a script that will use the URL
scheme to route the request to the right handler.
To associate a particular platform service with platformRequest(),
simply add a com.sun.midp.midlet.platformRequestCommand attribute to
the system.config file in the toolkit's lib directory. For example, to
invoke the Mozilla browser whenever platformRequest() is called, add
the following to system.config:
# Associate the Mozilla browser with platformRequest() - Windows
com.sun.midp.midlet.platformRequestCommand: "C:\Program Files\mozilla.org\Mozilla\mozilla.exe"
Given this setting, the call
platformRequest("http://developers.sun.com/mobility") will launch
Mozilla, and the browser will navigate to Sun's developer mobility
portal...