Cannot find symbol - beginners curse?

264 views
Skip to first unread message

noelmar...@gmail.com

unread,
May 25, 2017, 11:35:57 AM5/25/17
to j2objc-discuss
Hi,

Trying to get an initial j2objc Xcode project off the ground without success. I can add the files to the project and build them. I can reference them in obj-c files (as long as I toggle the --no-package-directories switch off then on again - problem 1). My main issue, though, is I cannot inter-reference the java classes between themselves even though they are in the same package.

so file 1 is:

package myco.crosscheck;

import java.text.Normalizer;

public class SimilarString {
private String stringA, flatStringA;

public SimilarString(String string1)
{
stringA = string1;
}
}


And file 2 is:
package myco.crosscheck;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class BasicCrossChecker {

public BasicCrossChecker()
{
Object ss = new SimilarString(); // Builds without this line. See the error below
}
}

Error displays as:
BasicCrossChecker.java:54: cannot find symbol
symbol: class SimilarString
location: class myco.crosscheck.BasicCrossChecker

I've also tried ss = myco.crosscheck.SimilarString(); but also gives the same error.

Am I missing something obvious?

Thanks!

Keith Stanger

unread,
May 25, 2017, 11:59:48 AM5/25/17
to j2objc-discuss
Sounds like you need to add your Java source directory to j2objc's -sourcepath.

--
You received this message because you are subscribed to the Google Groups "j2objc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to j2objc-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

noelmar...@gmail.com

unread,
May 25, 2017, 12:23:38 PM5/25/17
to j2objc-discuss
The -sourcepath was correct, but the files weren't in the classpath file structure. No I moved them into "myco/crosscheck/" it's working.
Thanks for taking the time - it steered me in the right direction in answering you :)

jcos...@gmail.com

unread,
Mar 17, 2020, 4:09:42 PM3/17/20
to j2objc-discuss
Hi mate
Who you resolve this problem?
What you put in class path?
Please, help me
Reply all
Reply to author
Forward
0 new messages