Jmonitor
Listen and Control my Softrock Ensemble II SDR
CQ DC

jmonitor for N8MDP's Softrock Ensemble II:

You can control my Softrock Ensemble II SDR with a Java application called "jmonitor". This is a fully functional SDR that you can control through this webpage. Simple Instructions:

1. You have control of the SDR if "Master-Mode" appears in the box to the right of the DSP button. Otherwise you are just a listener. Other people may be using the radio.

2. Swipe the spectrum or waterfall with your mouse to change frequency.

3. The UP/DN buttons increase or decrease the frequency by 1kHz.

-->
On which SDR will jmonitor work?

jmonitor works with Linux based SDR servers that use the GHPSDR3-ALEX server code protocols. More information can be found at:

http://napan.ca/ghpsdr3/index.php/Main_Page

Where can I get a copy of jmonitor?

https://github.com/n8mdp/jmonitorUpdateN8MDP.git

jmonitorUpdateN8MDP-master.zip

How do I get jmonitor to work on my website?
In order to get jmonitor compiled and running on your server, you will need the following:

Software or Resource
Version Required
NetBeans IDE
6.9, 7.0, 7.1, 7.2
Java Development Kit (JDK)
version 6 or 7
jmonitor Zip Archive
1.0

Opening the Project

You first need to open the jmonitor application in the IDE. The application is already packaged as a NetBeans IDE project so you only need to open the project in the IDE.

Let's begin with the steps to configure your project settings so that this Java application can be launched in a web browser.

1. Download the jmonitor archive.

2. Extract the archive to a location on your system.

3. In the IDE, choose File > Open Project from the main menu.

The jmonitor project opens in the Projects window. You can expand the project's nodes to view the source files.

There are a couple of changes you will need to make to my code so it will work with your IP address. These changes will take place in Main.java and Client.java. Follow these steps:

1. In the projects window, double click on Main.java

2. Look in the 'public static void main(String[] args)' area for this line of code: String server="n8mdp.dyndns.org";

3. You will need to change the IP address to your local IP address first. In my case, it was 192.168.254.53. This allows you to test local operation first.

4. Save the file.

5. In the projects window, double click on Client.java

6. Search in the variable declaration area for this line of code: private String server="n8mdp.dyndns.org";

7. You will need to change the IP address to your local IP address again. In my case, it was 192.168.254.53. This allows you to test local operation first.

8. Save the file

You are now ready for the next steps

With Java Web Start, the user can launch a Java application by clicking an HTML link to a JNLP file for this application inside a web browser. The JNLP file, which is a special configuration file, instructs Java Web Start to download, cache, and run the Java application. To run applications with Java Web Start, it is enough to have a compatible version of the Java Runtime Environment (JRE) installed on the client machine. The installation of the Java Development Kit (JDK) is not required.

To enable your Java application to run with Java Web Start, you need to configure the properties of how the IDE should build the project. When Java Web Start is enabled in project properties, the IDE automatically creates a JNLP file and an HTML page with the link to the JNLP file, together with the JAR file.


Configuring the Project to Enable Java Web Start


In this section, you will configure the project to make it Java Web Start enabled and test its execution locally.

1. Right-click the jmonitor project node and choose Properties.

2. Under Categories, choose Web Start and select the Enable Web Start checkbox.

3. Choose the Local Execution option from the Codebase drop-down list as we will first run the application locally. The Codebase Preview field shows the path to local application files.

4. Click Customize to open the Signing dialog box. Select the self-sign by generated key option.  The application JAR file will be signed by a certificate that is generated automatically when the project is built. With the self-signed certificate, the application will be able to access the same resources from the computer as a regular application that is running locally. For example, the self-signed certificate allows an application to access local files and the network.

5. Leave Enable Software Protections selected in the Mixed Code drop-down list and click OK.

6. Make sure that the 'Application descriptor (use project Main class)' radio button is selected.

7. Click OK to close the Project Properties dialog box.

Compiling and Running the Java Web Start Application from the IDE


To compile and run the application to test Java Web Start locally:

1. Select the jmonitor project node in the Projects window and then choose Run > Set Main Project > jmonitor in the main menu.

2. Choose Run > Run Main Project or press F6. 
The IDE compiles sources and you should see the splash screen that Java is starting and the warning window asking you whether the signed application can be executed.

3. Select the checkbox to trust the content and click Run in the warning window.  The jmonitor application starts and hopefully, you are hearing your SDR.

Exploring Java Web Start Files

Now let's take a closer look at the Java Web Start files that were created by the IDE during the build process. To view the files, open the Files window in the IDE and expand the dist folder. For Java Web Start, the following two additional files are created:

=> launch.jnlp - This is an XML file with special elements and attributes that instruct browsers how to run the application. JNLP stands for the Java Network Launching Protocol. Attributes of JNLP files can include the JNLP spec version, application title, vendor name, a link to the application JAR file, etc. The file should look like this:

=> launch.html - This is an automatically generated HTML page that has a link to the JNLP file. Users click this link to start applications via Java Web Start. This generated HTML file also has a commented-out reference to the publicly available Java Deployment Toolkit (deployJava.js), which provides JavaScript functions in order to avoid browser compatibility issues. You can find more information about the Java Deployment Toolkit here. The file should look lije this:


You can try doing the following: outside of the IDE, navigate to the launch.html file on your system, open it in your browser and click the link to launch the jmonitor application.

When you open the launch.html file in a web browser, you should see the following (this is what I see in Google Chrome):

When you click on the hyperlink, Launch the application, the launch.jnlp file downloads to your hard drive. Where the file was downloaded, you should be able to 'right-click' on the file and select "Open with". Make sure that you select the Java(TM) Web Start Launcher. The Java launcher should start with the Java splach screen. From there you should get the folllowing window much like you did before:

Make sure the "I accept the risk and want to run this application" checkbox is checked. Hit Run. If everything works, the jmonitor application will start.

Running the Application from a Remote Location

Here comes the interesting part of the process. After you verified that the application starts successfully with Java Web Start from local sources, we need to upload it to a remote location and launch it from there, such as what I have done so that jmonitor works on this page at the top.

Note: For deployment of applications with Java Web Start on the web, the web server you are using should be able to handle JNLP files. The web server must be configured to recognize JNLP files as applications, i.e. the MIME type for JNLP should be added to the configuration of the web server. Otherwise, files with the JNLP extension will be treated as usual text files. For more information about web server configuration, refer to the Java Web Start Guide.

Not every ISP provides this. Mine didn't! So I installed mine on a computer that is running the WAMP server which supports the JNLP.

Modifying the JNLP File

To launch the application from the web, you need to provide a link to the applications source file on the web server you are planning to use in the JNLP file.

1. Right-click the jmonitor project node, choose Properties and select Web Start under Categories.

2. Choose User Defined (e.g. HTTP deployment) as the Codebase.

3. In the Codebase Preview field, enter the URL where you will be uploading the source files. For example: http://mydomain.com/myuser/jmonitor/. If you happen to be using a tool like dynamic DNS, make sure that you use the dynamic DNS URL. For example, my URL is: http://n8mdp.dyndns.org/n8mdpASP/jmonitorN8MDP

4. I strongly recommend that you select the "Applet descriptor" radio button and make sure that the line shows: jmonitor.MonitorApplet. I had a problem with the Application descriptor (use project Main class) to deploy jmonitor.

5. Click OK in the Project Properties window.

6. Right-click the jmonitor node and choose Clean and Build. This IDE command deletes all previously compiled files and build outputs, recompiles your application, and builds output files with current settings.

Before we move the files to the server, we have to make a change to the launch.html file. When NetBeans creates the launch.html file, it creates a file that looks like this:

Unfortunately, this didn't work for me. For some reason, the code that says:

<applet width="480" height="230">
<param name="jnlp_href" value="launch.jnlp"/>
</applet>


only wants to download the launch.jnlp file and not actually run the application in a web browser. So I reviewed how John Melton G0ORX rewrote this to get it to work.

First, the best thing to do is to delete this code:

<h3>Test page for launching the applet via JNLP</h3>
<applet width="480" height="230">
<param name="jnlp_href" value="launch.jnlp"/>
</applet>
<!-- Or use the following script element to launch with the Deployment Toolkit -->
<!-- Open the deployJava.js script to view its documentation -->
<!--

 

We need to update this code with the correct information:

<script src="http://java.com/js/deployJava.js"></script>
<script>
   var attributes = {
       codebase: [applet codebase],
       code: [class to launch],
       archive: [JAR file with the applet],
       width: [applet width],
       height: [applet height]
   };
   var parameters = { [applet parameters] };
   var version = [JDK version];
   deployJava.runApplet(attributes, parameters, version);
</script>

 

To get the application to load and run correctly, I modified this section to the following:


<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { code:'jmonitor.MonitorApplet', width:480, height:230} ;
var parameters = {jnlp_href: 'launch.jnlp', server: 'n8mdp.dyndns.org', receiver: '0'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>

Note that it is important that you use the correct server IP address.

Finally, you also need to erase the '-->' just above the </body> line in the code. That was the closing HTML comment symbol when this code was originally commented out. When you are done, the launch.html file should look something like this:

Save the file. Now you are ready to load files to your server.

 

Uploading the Source Files

Upload the launch.html, launch.jnlp, jmonitor.jar, and the lib file folder from the 'dist' file folder in the jmonitor project to your server in the file folder path you specified in the Codebase Preview line in NetBeans. Once you have uploaded the files and folder, you should be able to test the system by launching the launch.html file locally. Hopefully, jmonitor will begin to run. If your internet router/gateway does not allow loopback (like mine), you have may to change IP addresses in Main.Java and Client.Java in Netbeans to an IP address behind your firewall. Follow the process above once again. In my case, I run two version, on just for me behind my firewall and another version so that outside listener can operate jmonitor.

 

If you have any questions, feel free to email me at: ars_n8mdp@windstream.net and I will try to give you assistance.

 

Scroll
to Top