Microsoft SDK for Java 1.5 Welcome!
Welcome!

Frequently Asked Questions (FAQ)

Documentation Roadmap , General Questions , ActiveX/OLE Questions

Documentation Road Map Questions

General Questions

Microsoft ActiveX/OLE Questions


Documentation Roadmap

Where should I begin reading in the SDK for Java documentation?

Be sure to read the Release Notes first. If you are developing Java applets and applications for end users, you might be interested in reading about the tools and classes contained in this SDK for Java. It includes topics such as Packages and Classes, Tools, Java and COM, and Raw Native Interface.

If you are a tools developer, read the information in the Working with Microsoft VM section.


General Questions

What is the current version number for the Microsoft Java VM?

Build number 1257 is the current release of the Microsoft Java VM. For more information, see the article in the Microsoft KnowledgeBase titled "Availability of Current Build of Microsoft VM for Java" or visit http://www.microsoft.com/java.

Is it possible for an applet to read a file from my web server? If so, how?

The class below shows how to read a text file named poem.txt from the server. Note: place the .htm and .class files in the same directory on the web server along with a text file named poem.txt with at least one line of text.


import java.io.*;
import java.net.*;
import java.applet.*;
import java.awt.*;

class ReadFile extends Applet {
	public void start () {
		try {
			URL u2 = new URL(getCodeBase(),"poem.txt");
			DataInputStream d = new DataInputStream(u2.openStream());
			String s5 = d.readLine();
			add(new Label(s5));
		}
		catch (Exception e) {
			System.out.println("Error: " + e.toString());
		}
	}
}

When will AFC be widely available?

AFC will be available in Q1 '97 in a public beta.

When I use JavaTLB to generate classes from some COM object libraries, I get an error J5008. Should I be concerned?

All methods that produce a J5008 warning are omitted from the class file. Often, the cause of this warning is that the method uses a type that is not supported in Java.

Can I build an OLE automation server using just the SDK for Java or do I need to buy Visual J++?

The javareg.exe tool was not included with the SDK 1.0, but is now a part of the current release of the SDK for Java.

Is there a way for you to make Java Applets use a .cla file instead of a class file to conform to the 8.3 naming convention (for example, CODE="anim.cla" instead of CODE="anim.class")?

Using the Microsoft Java VM for Win16, you will be able to use long file names by referencing them directly on your Web server in the <applet> tag of the HTML, or by placing them in a uncompressed zip file. The appropriate tag to use a zip file is <Applet code=myclassname CODEBASE=classinzipfile.zip> This would only be necessary for classes that exist on the Win16 local machine.

Where can I obtain the code signing kit? It is not included with the SDK for Java.

You can get the code signing kit in the ActiveX SDK. For more information and to download, click on the Overview link under Authenticode section in the left pane of this page: http://www.microsoft.com/intdev/security/.

What are common causes of the "Failed to create object" message when trying to instantiate a COM object written in Java?

When I create an ActiveX control in Java and then call its methods I get a java.lang.UnsatisfiedLinkError exception. Why can't I call the methods?

The problem is that Applets aren't ActiveX containers and therefore cannot host ActiveX controls. The call to "new myActiveXControl();" doesn't make sense because there is no container to host the control. You should use an <OBJECT> tag in your HTML file, and then pass this object reference to your Applet. For an example of how this is done, see the "OLEControls" sample in the Microsoft Visual J++ samples documentation.

How can I get showDocument() to display a URL, when the URL protocol isn't supported by Java (for example FTP)?

The URL class verifies Java protocol support by calling the protocol's Handler class. The four steps below show how to add a protocol and demonstrate how to make the call to showDocument.

  1. Create a package to implement the protocol. For example, .\sun\net\www\protocol\ftp
  2. Implement the Handler class in the sun.net.www.protocol.{protocol-name} package. For example, .\sun\net\www\protocol\ftp\Handler.java.
    
        package sun.net.www.protocol.FTP;
        import java.net.URL;
        import java.net.URLConnection;
        import java.net.URLStreamHandler;
        public class Handler extends URLStreamHandler {
           public synchronized URLConnection openConnection(URL u) {
    	  return new FTPURLConnection(u);
           }
        }
    
  3. Implement any functions your Handler class uses.
    
        package sun.net.www.protocol.FTP;
        import java.io.IOException;
        public class FTPURLConnection extends sun.net.www.URLConnection {
           FTPURLConnection(java.net.URL u) {
              super(u);
           }
           public void connect() throws IOException {
              throw new IOException("FTP doesn't support connect().");
           }
        }
    
    
  4. Create the URL and call the showDocument function.
    
        import java.net.*;
        public class FTPTest extends java.applet.Applet {
           public void init() {
              add(new java.awt.Button("Click to open FTP session."));
           }
           public boolean action(java.awt.Event  evt, Object  what)	{
              try {
                 URL u=new URL("ftp://ftp.microsoft.com");
                 getAppletContext().showDocument(u,"FTPFrame");
              } catch (Exception e) {
                 showStatus(e.toString());
                 e.printStackTrace();
              }
    	  return true;
           }
        }
    

What are the differences between the Microsoft SDK for Java and Microsoft® Visual J++™?

Visual J++ is a Java language product that provides a complete Microsoft® Windows®-based development environment for Java. The Microsoft SDK for Java, on the other hand, is a tool-independent product. It gives developers and tools vendors the latest Microsoft Win32 Reference Implementation virtual machine (Microsoft VM for Java) and Microsoft class library extensions for redistribution, as well as detailed information related to the Java VM, Just-In-Time (JIT) compiler, and other platform components.

What operating systems does the Microsoft SDK for Java support?

The SDK for Java runs on Microsoft Windows® 95 or higher and Windows NT version 4.0 or higher.

What version of Microsoft® Internet Explorer (Internet Explorer) do I need to use the Microsoft SDK for Java?

The SDK for Java is a development environment that allows developers to write stand-alone Java programs. Consequently, Microsoft suggests that you download the Internet Explorer version 3.01 browser (or latest version of another browser that supports the Microsoft VM for Java) for testing purposes. If you find any issues related to the Microsoft VM supporting other browsers, please send your comments or a bug report to.

Is there any sample code in the SDK for Java showing how to use the SDK features?

The SDK for Java includes many samples covering the raw native interface, Java/COM integration, calling DirectX libraries from Java, as well as others.

What parts of the SDK for Java can I redistribute?

Read the online release notes of the SDK. These notes link to the redistribution document that lists all the components that you can redistribute with your application. For terms and conditions of the redistribution, refer to the SDK license. Both license and redistribution documentation (redist.htm) are also part of the SDK download.

How can I submit feedback about the SDK for Java?

Subscribe to the newsgroup microsoft.public.internetexplorer.java to provide feedback and read feedback from others. To help Microsoft track the bugs, use the online bug report provided on the SDK for Java Web site. Your feedback is appreciated and your suggestions will be carefully considered.

What DirectX technologies are available on Windows NT 4.0?

Windows NT 4.0 provides support for Microsoft® DirectDraw®, DirectPlay®, and DirectSound®. A beta version of the Microsoft Driect3D™ run-time components is provided in the Microsoft® Win32® SDK (from Microsoft Developer Network) for Windows NT 4.0.

Does Microsoft provide native code support?

Yes, the Raw Native Interface provides access to native code support using the Microsoft VM for Java. See the Raw Native Interface documentation for more information.

I installed the Microsoft SDK for Java and discovered I needed Msvcert.dll to run the Microsoft Java compiler. Where can get this?

The current version of the SDK automatically installs Msvcert.dll into your \Windows\System directory when you run the setup. If you are missing this dynamic-link library program, download the current Microsoft SDK for Java.

How do I specify a destination directory for the SDK for Java download?

The current version of the SDK for Java has a feature for specifying the destination directory for the download. For installation requirements and instructions, read the online Release Notes in the SDK for Java.

How do I protect my Java object when it is used in native code?

Use the GCFrame, GCFramePop, and GCFramePush classes to inform the garbage collection in the Microsoft VM for Java of your native pointers. Object pointers kept in a garbage collection frame will be automatically updated if the object is moved. For more information about , see "Garbage Collection Issues" in the Raw Native Interface documentation.

Is the SDK for Java available on CD-ROM?

There are CD-ROM versions being released for special events, such as the Site Builder's Conference and the Product Developer's Conference. However, the primary delivery mechanism for the most current binaries and documentation is through the Web.

How do I get my applet to access the user's local computer?

Any classes used by an applet that access the user's local computer must be installed in the class past of that computer. Use the Cabinet Developer Kit, supplied with this SDK, to bundle classes that access the client computer into a digitally-signed .cab file, which can be downloaded to the client computer and installed on the user's class path.

Will the Microsoft VM for Java support JDBC?

Yes, Microsoft plans to support JDBC in a future release of the Microsoft VM for Java.

How do I uninstall the SDK for Java?

To uninstall the Microsoft SDK for Java, delete the directory on your hard drive that you installed it in. If you installed the Microsoft VM for Java, it does not need to be removed: It will continue to be used by your existing installation of Internet Explorer 3.01. The Redist.htm file included with the SDK for Java has a complete list of the files in the Microsoft VM if you want to remove them from your hard drive.

How do I redirect output from jview or wjview?

Unfortunately, there is not an option or registry setting for jview or wjview that enables Java logging. However, you can redirect the output when invoking an application like the following example:

jview main > javalog.txt

This works for both jview and wjview. Or, you could programmatically direct the output to a file or pipe by reassigning System.out. The following code, which works for jview/wjview and Internet Explorer, shows how this can be done:


	if ("true".equalsIgnoreCase(System.getProperty("com.ms.applet.enable.logging"))) {
              try {
                String logdir = System.getProperty("java.home");
                PrintStream ps = new PrintStream(new BufferedOutputStream(new
                    FileOutputStream(new File(logdir, "javalog.txt"))), true);
                System.out = ps;
                System.err = ps;
              } catch (Exception e) {
              }
	}

How does Msdev.exe relax the security in Internet Explorer so that my applet can run outside the so-called Java sandbox, despite the fact that it is not in a signed .cab file?

In the Microsoft VM for Java that is included with Internet Explorer 3.x, only trusted class files can access resources outside the Java "sandbox." Class files from digitally-signed .cab files are trusted.

If the HTML file is run from Microsoft Developer Studio (MSDEV), the class files are also trusted. This can be very helpful during applet development. However, to deliver your applet to other users, you must put it in a signed CAB file.

When executing or debugging a Java Applet from MSDEV, the security restrictions in Internet Explorer are relaxed for quick and easy testing. MSDEV prepends the project path to the CLASSPATH environment variable that is used by Internet Explorer. This gives the classes trusted status.

What are the redistribution rights with the new version of the Microsoft Win32 VM for Java for the Power PC and Alpha?

The redistributable, self-extracting executable containing the Power PC and Alpha versions of the Microsoft Win32 VM for Java are available by request only. To do so, send a request to sdkjava@microsoft.com. Be sure to put "REDIST" on the subject line of the message.


ActiveX/OLE Questions

What are some good Web sites for learning about COM?

For detailed information and samples covering the COM (Component Object Model) foundations of ActiveX™ technology, see the COM Tutorial at the Site Builder Workshop site.

Can you recommend any reference books for Windows programming or OLE?

Several books from Microsoft Press, including "Advanced Windows" by Jeffrey Richter and "Inside OLE" by Kraig Brockschmidt, make great references for Java developers who want to work with ActiveX technology.

What is a GUID?

A GUID is a globally unique identifier, a 128-bit (16-byte) integer that an algorithm creates. The algorithm uses several factors, including the current date, time, and a computer identifier, to ensure that it will be unique. GUIDs are used extensively in the OLE Component Object Model (COM) and have an important role in Microsoft® ActiveMovie™.

How do I get a GUID?

A GUID can be generated using guidgen.exe. Guidgen, a Windows-native program, is included with Microsoft's Visual C++ products. Developers can also use uuidgen.exe, a console application, from the Win32 SDK.

When do I need to call QueryInterface?

Call QueryInterface whenever you need to obtain an interface for an object.

Top© 1997 Microsoft Corporation. All rights reserved. Terms of Use.