Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:14:56+00:00 2026-06-13T21:14:56+00:00

I am using IKVM to port some java libraries into my c# project. The

  • 0

I am using IKVM to port some java libraries into my c# project. The library api (StanfordNLP) requires that a file be loaded to train the statistical models used by the nlp functions. Loading the file from the file system has worked well for weeks, but I would now like to add the file as an embedded resource in a dll, rather than retrieving it from the file system.

The problem is that the java api is not finding the .net embedded resource.

Here is a snippet of code that works when retrieving a file from the file system:

public class SNLPModel
{
   public LexicalizedParser LP;

   public SNLPModel()
   {
      // Using a relative file path in the target build directory
      LP = LexicalizedParser.loadModel("models-stanford\\englishPCFG.ser.gz");
   }
}

But when I make the “englishPCFG.ser.gz” file an embedded resource in visual studio (using VS2012), and change the code to match:

public class SNLPModel
{
   public LexicalizedParser LP;

   public SNLPModel()
   {
        // Using this line of code to verify that the file is being loaded as
        // an embedded resource. Running in debug, I have verified that it is, and
        // noted its complete name.
        string[] s = System.Reflection.Assembly.GetExecutingAssembly()
                        .GetManifestResourceNames();

        java.io.InputStream modelFile = java.lang.ClassLoader
              .getSystemResourceAsStream
              ("FeatureExtraction.StanfordNLP_Models.englishPCFG.ser.gz");

        java.io.ObjectInputStream x = new java.io.ObjectInputStream(modelFile);

        LP = LexicalizedParser.loadModel(x);
   }
}

the InputStream object, modelFile, is always returned null. I have tried various forms of the resource string, replaceing the first two dots (“.”) with forward slash (“/”), backslash (“\”) and double backslash (“\\”). I am beginning to suspect that java.io cannot access the .net resource. It would not be surprising that the java api does not recognize the .net resources, but I thought IKVM might provide a bridge. I have seen a reference to something called IKVM.Internals.VirtualFileSystem, but only the one reference (http://old.nabble.com/Manual-by-name-embedded-resource-lookup–td31162421.html) and haven’t found any IKVM dlls that actually contain the class.

Any help would be much appreciated. I am using:

c#.NET 4.5

Visual Studio 2012

Latest Stanford NLP java libraries

IKVM 7.0.4335.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:14:57+00:00Added an answer on June 13, 2026 at 9:14 pm

    There is no automatic support for this in IKVM, but it is really easy to do it yourself:

    var asm = Assembly.GetExecutingAssembly();
    var stream = asm.GetManifestResourceStream("FeatureExtraction.StanfordNLP_Models.englishPCFG.ser.gz");
    var inp = new ikvm.io.InputStreamWrapper(stream);
    var x = new java.io.ObjectInputStream(inp);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that uses a Java library converted using IKVM . I
I've converted an api written in Java into a .net dll using IKVM, and
In my current project I use IKVM to cross-compile several Java libraries that deal
I'm using the latest release of IKVM to compile a Java .jar file into
So I created an assembly referenced library of SVNKit (Java) using IKVM. In my
Having my own Java code I'm using C# to call some unmanaged code that
Google Closure works GREAT without the Java Runtime Environment by using IKVM In case
Using Java,I have to fetch multiple sets of values from an XML file to
I have this code in C# that uses IKVM to utilize Java's SHA1 encryption.
I'm trying to use java.util.List in a C# file. I have IKVM 0.40. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.