Java 17 소스 코드를 C++20로 변환하며, 변환 문제를 식별하고 호환 가능한 코드에 대해 자동 수정 기능을 제공합니다.
다른 이름 juangp3/j2cpp, j2cpp, @juangp3/j2c-mcp
- 스타
- 0
- Tools
- —
- 다운로드, 30일
- —
- 최신 버전
- 0.6.1
- 마지막 커밋
- 2026년 10월 27일
- 라이선스
- EPL-1.0
J2C Java to C++ MCP란?
J2C Java to C++은(는) MCP server입니다. Java 17 소스 코드를 C++20로 변환하며, 변환 문제를 식별하고 호환 가능한 코드에 대해 자동 수정 기능을 제공합니다.
프로젝트 README에서 생성된 요약
J2C Java to C++ MCP server 정보
J2C Modern Edition은 Java 17 소스 코드를 C++20으로 변환하기 위한 전문 도구 세트를 제공합니다. 이 도구는 전체 컴파일러가 아닌 소스 변환기로 작동하므로, 서로 다른 런타임 동작의 차이를 관리하면서 로직을 마이그레이션하려는 개발자에게 적합합니다. 시스템은 독립형 CLI 및 VS Code 확장 프로그램으로 사용할 수 있으며, 실행을 위해 Java 11 이상과 C++20 호환 컴파일러가 필요합니다.
사용자는 check 명령어를 사용하여 드라이 런을 수행함으로써 지원되지 않는 구문을 식별하거나, report 명령어를 사용하여 파일을 생성하기 전에 마이그레이션 범위를 평가할 수 있습니다. 이 도구는 Maven 및 Gradle과 통합되어 프로젝트 의존성 및 클래스패스를 자동으로 해결합니다. 정확성 검증이 필요한 개발자를 위해 run 명령어는 변환된 C++ 코드와 기존 Java 코드를 모두 실행하여 출력을 비교함으로써 동일성을 보장합니다. 또한 fix 명령어를 통해 익명 람다 참조나 패턴 매칭 제한과 같은 특정 문제에 대한 자동 수정 기능을 제공합니다.
활용 사례
- 1마이그레이션 난이도 평가마크다운 보고서를 생성하여 어떤 파일과 메서드가 문제없이 변환될 수 있는지 확인합니다.
- 2변환 정확도 검증변환된 C++ 프로그램을 실행하고 그 출력을 기존 JVM 실행 결과와 비교합니다.
- 3코드 수정 자동화Java 소스 코드에 기계적인 수정을 적용하여 일반적인 변환 차단 요소를 해결합니다.
- 4파일 생성 없는 호환성 검증소스 디렉토리를 스캔하여 지원되지 않는 Java 기능과 컴파일 오류를 찾습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
J2C Java to C++ MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 J2C Java to C++ MCP 설치
$ claude mcp add j2cpp -- npx -y @juangp3/j2c-mcpCursor에 J2C Java to C++ MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"j2cpp": {
"command": "npx",
"args": [
"-y",
"@juangp3/j2c-mcp"
]
}
}
}VS Code에 J2C Java to C++ MCP 설치
.vscode/mcp.json
{
"servers": {
"j2cpp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@juangp3/j2c-mcp"
]
}
}
}VS Code CLI에 J2C Java to C++ MCP 설치
$ code --add-mcp '{"name":"j2cpp","type":"stdio","command":"npx","args":["-y","@juangp3/j2c-mcp"]}'Claude Desktop에 J2C Java to C++ MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"j2cpp": {
"command": "npx",
"args": [
"-y",
"@juangp3/j2c-mcp"
]
}
}
}Codex에 J2C Java to C++ MCP 설치
$ codex mcp add j2cpp -- npx -y @juangp3/j2c-mcpCodex config.toml에 J2C Java to C++ MCP 설치
~/.codex/config.toml
[mcp_servers.j2cpp] command = "npx" args = ["-y", "@juangp3/j2c-mcp"]
Gemini CLI에 J2C Java to C++ MCP 설치
$ gemini mcp add -s user j2cpp npx -- -y @juangp3/j2c-mcpGemini settings.json에 J2C Java to C++ MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"j2cpp": {
"command": "npx",
"args": [
"-y",
"@juangp3/j2c-mcp"
]
}
}
}자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능juangp3/j2cpp is public and reachablegithub.com/juangp3/j2cpp ↗통과
- 패키지가 이 저장소를 소스로 명시@juangp3/j2c-mcp names juangp3/j2cpp as sourcenpmjs.com/package/@juangp3/j2c-mcp ↗통과
- 빌드 출처(Sigstore 증명)No build attestation published for this release검사되지 않음
- 오픈 소스 라이선스 (OSI)EPL-1.0 is not OSI-approvedspdx.org/licenses/EPL-1.0.html ↗결함 발견
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-10-27github.com/juangp3/j2cpp ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from @juangp3/j2c-mcp통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음1 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기J2C Modern Edition
J2C translates Java source code to C++. This repository packages the standalone command-line translator and the J2C Java to C++ VS Code extension. It is a modernized continuation of arnetheduck/j2c, whose original Eclipse plugin remains in that repository.
Preview: J2C is a source translator, not a complete Java compiler or runtime. Java feature support is incremental. Generated C++ may need manual changes and a compatible implementation of Java runtime behavior. Do not assume that arbitrary Java programs compile or preserve all JVM semantics.
Requirements
- Java 11 or newer to run the CLI and VS Code extension.
- Maven to build the CLI from source.
- A C++20 compiler for generated Makefiles and C++ output.
- Node.js 22 or newer and npm to package the VS Code extension.
CLI
Build the executable JAR from the repository root:
mvn package
Create an output directory and translate a Java file or source directory:
mkdir generated
java -jar target/j2c-cli.jar \
--output generated \
--sourcepath test/src \
test/src/se/arnetheduck/j2c/test/Hello.java
Use the platform path separator between multiple source roots or classpath
entries (; on Windows, : on macOS/Linux). Source paths help resolve Java
source dependencies; classpath entries should identify dependency JARs or
class directories. If --sourcepath is omitted, J2C infers roots from the
selected inputs.
The --sealed-types policy defaults to advisory. Sealed declarations are
translated using ordinary C++ inheritance and generated comments list
permitted direct subtypes; C++ does not enforce Java's permits restriction.
Choose --sealed-types reject to stop translation when sealed or non-sealed
declarations are encountered.
Additional optional arguments are --classpath <paths>, --name <name>,
--sealed-types advisory|reject, and --encoding <charset>. Java sources are
read as UTF-8 unless --encoding says otherwise; generated C++ is always
written as UTF-8.
Translate against the J2C runtime so the program runs without writing any C++:
java -jar target/j2c-cli.jar --runtime bundled --output generated test/runtime/hello
make -C generated all mains && generated/bin/Hello
--runtime bundled uses the runtime packaged in the CLI JAR (and in the VS
Code extension), so no repository checkout is needed: on first use it is
extracted to ~/.j2c/cache/runtime-<version>-<hash> (or J2C_CACHE_DIR),
reused while its files are intact, and replaced when they are not.
--runtime <directory> uses another runtime directory, such as a checkout's
runtime/ (name a directory called bundled as ./bundled). Without
--runtime, the default, java.* comes from the running JDK and every JDK
class is a stub that fails at run time; with it, java.* comes from the
runtime, so JDK classes it does not provide are compile errors that
--check lists. See runtime/README.md for what it
covers.
j2c run translates, builds and runs a program in one step, runs the same
main class on the JVM, and compares the two:
java -jar target/j2c-cli.jar run --output generated test/runtime/hello -- one "two words"
java -jar target/j2c-cli.jar run --output generated --format json --main Stdin --stdin test/runtime/stdin/input.txt test/runtime/stdin test/runtime/hello
It translates against the runtime (--runtime, default bundled) with
--line-directives, builds the main class's binary (make bin/<Class>, run
as j2c build runs make, so a failed build reports the compiler's errors
at their Java lines), runs it in a fresh working directory with the
arguments after -- and the bytes of --stdin <file> as standard input,
compiles the same sources with the javac of the JDK running J2C, and runs
the class with java (in WSL when the build ran there: --java <program>,
else J2C_WSL_JAVA, else java on WSL's PATH, else the Windows JDK
running J2C, with a note). It compares standard output, standard error
without the JVM's stack frames, and the exit code, and prints the C++
program's output, how each run ended and the first line that differs.
--main <class> chooses among several classes with a main method,
--no-compare only runs the C++ program, --timeout <seconds> (default 60,
0 for none) stops each run and everything it started, and
--output-limit <characters> (default 20000) caps the output reported for
each stream. With --format json the result has status (ok, differs,
failed, crashed, timeout or build-failed), cpp and jvm (exit
code, signal, timedOut, durationMillis, stdout and stderr with
their byte counts and whether they were truncated), comparison (equal,
differs or skipped, with firstDifference of each stream: line, cpp
and jvm) and build.
Check whether code can be translated before writing anything:
java -jar target/j2c-cli.jar --check --sourcepath src/main/java src/main/java
--check takes the same inputs as a translation but no --output. It prints
every compile error and unsupported construct in the selected files as
file:line: message, followed by a summary per kind, and writes no files.
Select a source root to check a whole project. --version prints the CLI
version.
Maven and Gradle projects
Pass a project directory (one with a pom.xml, build.gradle(.kts) or
settings.gradle(.kts)) and J2C sets itself up from the build:
java -jar target/j2c-cli.jar --check .
java -jar target/j2c-cli.jar --tests --output generated .
- Source roots: Maven's
src/main/java(or<sourceDirectory>) of every module listed in<modules>, plus roots added bybuild-helper-maven-plugin; Gradle'ssrc/main/javaof the root project and eachincluded subproject, or the source sets Gradle reports. With--tests, the test roots (src/test/java,<testSourceDirectory>) too. - Class path: J2C runs the project's wrapper (
mvnw,gradlew) or elsemvn/gradlefrom thePATH. Maven runsdependency:build-classpath(compile scope, or test scope with--tests); in a multi-module build whose modules depend on each other it also runs thecompilephase with compilation skipped, so plugins bound to earlier phases run. Gradle gets an init script (--init-script) that printscompileClasspathandtestCompileClasspath, retried with--offlineif it fails. The build may download dependencies. Other modules' output is left out, because their sources are translated. - What was detected, and the command run, is printed to stderr, and is in
the JSON output as
projects. Resolved class paths are cached in~/.j2c/cache(orJ2C_CACHE_DIR), keyed by a hash of the build files. - If the tool is missing or fails, J2C still uses the source roots and
reports the warning
J2C-PROJECT-CLASSPATH-UNRESOLVED(inwarningsin JSON); dependency types then fail to resolve.
--no-build-tool never runs Maven or Gradle (a cached class path is still
used). --project none turns detection off, and --project <directory>
uses that directory's build for other inputs, such as one file in it.
Detection only looks at the input directories themselves, never at their
parents.
The output directory must be empty or earlier J2C output, which is marked with
a .j2c-output file. Translation first moves the directory's current
contents to a backup in the temporary folder, so J2C refuses other non-empty
directories unless you pass --force. Every selected file is checked before
that: when one has problems, the translation fails with all of them and
leaves the directory as it was. The build's objects and libraries (obj/ and
bin/) stay, and a generated file that comes out the same keeps its earlier
modification time, so make (and j2c build, j2c run and j2c test)
compiles again only what changed: after the first build, a run against the
runtime no longer compiles it all again. Changing the compiler or its flags
(CXX, CFLAGS) compiles everything again.
Files that are only dependencies (found on the source path, not selected)
and do not compile are translated like library classes, as a header and
stubs without an implementation, with the warning J2C-DEPENDENCY-ERRORS
(in warnings in JSON) instead of an error.
Each problem has a stable ID (such as J2C-LAMBDA-ANONYMOUS-THIS).
j2c explain <id> describes it and how to fix it; j2c explain lists them
all. --format json makes translation and --check print a single JSON
object (problems with ID, file, line, column, message and hint; or the
generated files). j2c capabilities prints the supported features and
limitations as JSON.
Some problems have a mechanical fix, which j2c fix makes in the Java source:
java -jar target/j2c-cli.jar fix src/main/java # preview as a unified diff
java -jar target/j2c-cli.jar fix --apply src/main/java # write the fixes
It takes the same inputs and options as --check (except --output, --name
and --force). The preview prints a diff on stdout that git apply accepts;
--apply writes the fixes, checks again, and repeats until no fixable
problem is left. Fixes exist for J2C-LAMBDA-ANONYMOUS-THIS (a
var self = this; local used in the lambda), J2C-LAMBDA-INTERFACE-SUPER
(the Iface.super.m() call moved into a private method),
J2C-PATTERN-OUTSIDE-METHOD (the field initializer moved into a private
method), J2C-TEST-TIMEOUT (the timeout removed) and
J2C-TEST-PRIVATE-METHOD (private removed). With --format json, every
problem lists its fixes as exact edits (file, a range with 1-based
line and column, and newText).
j2c report assesses a migration before you start it:
java -jar target/j2c-cli.jar report . > migration-report.md # Markdown
java -jar target/j2c-cli.jar report --format json src/main/java # JSON
It takes the same inputs and options as --check (and --runtime) and shows
the files, types and methods that translate as they are (no problem from
--check lies within them), the blockers by problem ID and by package with
their top locations and how many j2c fix can fix, test-feature blockers
with --tests, the JDK types and members the code uses compared with what
the J2C runtime provides (the rest would be stubs that fail at run time),
and next steps.
--line-directives adds #line directives to the generated C++, so compiler
errors and debuggers (gdb: break Foo.java:21, list) refer to Java files
and lines. Each C++ line maps to the Java statement it came from, also in
lambdas; generated boilerplate keeps its C++ file and line. Paths in the
directives are relative to the output directory, where make runs. Without
the option the generated files are unchanged.
j2c build compiles translated code and reports the compiler's errors at
their Java lines:
java -jar target/j2c-cli.jar build --output build/cpp src/main/java # translate with directives, then make
java -jar target/j2c-cli.jar build --output build/cpp --format json # build earlier J2C output
It runs make -k in the output directory (in WSL on Windows when make is
not on the PATH; --wsl auto|always|never, --wsl-distro <name>,
--make <program>, --target <target>, --jobs <n>, or the variables
J2C_MAKE, J2C_WSL and J2C_WSL_DISTRO), parses GCC and Clang
diagnostics, and prints each at its Java file and line with its C++
location. A diagnostic in generated code outside any Java statement is
reported in C++ with the nearest Java line before it. With --format json
the result has status, exitCode, diagnostics (severity, message,
java, cpp, mapped, notes, includedFrom), summary and the end of
the log.
The CLI exits with status 0 on success (or a clean check), 1 when translation
fails or a check finds problems, and 2 for invalid arguments. j2c build
exits with 0 when make succeeds, else 1; j2c test with 0 when no test
failed, else 1; j2c run with 0 when the program behaved as on the JVM (or,
with --no-compare, exited with 0), else 1. j2c fix exits
with 0 when no problem is left that needs changes by hand (after applying,
or that the preview cannot fix), else 1. j2c report exits with 0 whenever
it prints a report.
Unit tests (JUnit to GoogleTest)
--tests translates JUnit 4 and JUnit 5 test classes and generates a
GoogleTest file for each runnable one, so the project's own tests can run
against the C++ translation:
java -jar target/j2c-cli.jar --tests --output generated \
--sourcepath src/main/java:src/test/java \
--classpath junit-jupiter-api.jar src/main/java src/test/java
make -C generated test
GoogleTest only runs the tests and reports results. Each test gets a new
instance, as in JUnit; @BeforeAll, @BeforeEach, @AfterEach and
@AfterAll (and their JUnit 4 equivalents, including inherited ones) run in
JUnit's order. @Disabled and @Ignore tests are skipped with their reason,
and @Test(expected = ...) checks the thrown exception. A test fails when it
throws a Java exception, as in JUnit.
JUnit assertions and assumptions are translated into C++ helpers that follow JUnit's rules, so they work without a Java runtime:
assertTrueandassertFalse;assertNullandassertNotNull.assertEqualsandassertNotEquals, including floating-point delta forms. Doubles compare as JUnit compares them: NaN equals NaN, and 0.0 differs from -0.0.assertSameandassertNotSame;assertArrayEquals;fail.assertThrowswith a class literal, which returns the exception, andassertDoesNotThrow.assumeTrueandassumeFalse, which skip the test.
These work from both JUnit 5's Assertions and JUnit 4's Assert. A failed
assertion throws a Java AssertionError with the message that version of
JUnit gives, such as expected: <4> but was: <5> (JUnit 5) or
expected:<4> but was:<5> (JUnit 4). Object equality calls the translated
equals(), so it works for the project's own classes.
Translated with the J2C runtime (--tests --runtime bundled), assertions
also compare JDK objects with Java's equals (strings, boxed numbers,
lists, maps) and show values and messages as JUnit does:
- values print with their Java
toString, soexpected: <[1, 2]> but was: <[1, 3]>andexpected: <0.3> but was: <0.30000000000000004>; - JUnit 5's custom message comes first, as in
names ==> expected: <a> but was: <b>, and aSupplier<String>message is called only when the assertion fails; - JUnit 4 compacts two strings around their difference, as in
expected:<ab[c]def> but was:<ab[X]def>, and prefixes its message, as inname expected:<[a]> but was:<[b]>; - the
AssertionErrorcarries the message, so Java code that catches it sees it, and GoogleTest shows it with any other exception's message.
Without a runtime, JDK objects are stubs: messages describe objects by
type, and custom messages are not shown. Other forms (assertAll,
assertTimeout, lazy conditions, Hamcrest, AssertJ, Truth) are reported by
--check --tests.
j2c test does all of this in one step and reports each test at its Java
method:
java -jar target/j2c-cli.jar test --output generated --runtime bundled \
--sourcepath src/main/java:src/test/java src/main/java src/test/java
java -jar target/j2c-cli.jar test --output generated --format json \
--filter CounterTest,ParserTest.parsesEmpty src/main/java src/test/java
It translates with --tests and --line-directives, builds the GoogleTest
binary (make tests, run as j2c build runs make, so a failed build
reports the compiler's errors at their Java lines), runs it, and prints one
line per test that did not pass, at its Java file and line with JUnit's
message, then the counts. With --format json each test has javaClass,
javaMethod, file, line, status (passed, failed, skipped,
disabled, or notRun when the test process crashed or timed out first),
message, exception, timeMillis and cppTest, and summary has the
counts and the test binary's exit code. --filter takes test classes,
Class.method, Class#method or method names (comma separated);
--timeout <seconds> (default 300, 0 for none) stops the test process and
everything it started.
make test needs GoogleTest (found with pkg-config, or set GTEST_CFLAGS
and GTEST_LIBS) and, like any translated program, a C++ implementation of
the JDK classes the tests use: the J2C runtime, or your own passed with
TEST_LDLIBS.
The repository's own JUnit fixtures (test/junit, and test/junit-runtime
for JDK objects) are run three ways, and every outcome and recorded failure
message must equal expected-results.json: with real JUnit on the JVM
(npm run junit:jvm, which downloads JUnit with Maven into target/), and
translated, with GoogleTest, against stubs (npm run junit:gtest) and
against the runtime (npm run junit:gtest:runtime).
With --tests, --check also reports test features the wrappers cannot run:
mocking libraries (Mockito, PowerMock, EasyMock), runners, rules and
extensions, parameterized, repeated and dynamic tests, @Nested classes,
timeouts, @TestInstance(PER_CLASS), and private or parameterized test
methods. Each has a problem ID and a suggested fix.
gMock classes for new C++ tests
--mocks generates a gMock
class for each top-level and member interface of the translated files, so
C++ tests written by hand can pass mocks to the translated code:
mock/<package>/Mock<Interface>.hpp declares <package>::Mock<Interface>,
which derives from the translated interface.
java -jar target/j2c-cli.jar --mocks --output generated src/main/java
cp repository_test.cpp generated/test/
make -C generated tests USER_TEST_SRCS=test/repository_test.cpp
#include <gmock/gmock.h>
#include <demo/MockRepository.hpp>
#include <demo/Service.hpp>
TEST(Service, savesOnce)
{
demo::MockRepository repository;
EXPECT_CALL(repository, save(::testing::_)).Times(1);
demo::Service(&repository).run();
}
- Every abstract method is mocked with
MOCK_METHOD, including those inherited from superinterfaces, with the C++ types the translator uses: generic types and generic methods are erased (T get(int)in aRepository<T>isMOCK_METHOD(::java::lang::Object*, get, (int32_t), (override))), arrays and varargs are J2C arrays, and overloads are separate mocks (match them with typed matchers such as::testing::A<int32_t>()when their arity is the same). - Default methods are not mocked: they keep their Java bodies, which call
the mocked methods. Static and private methods are not virtual, and the
java.lang.Objectmethods an interface redeclares (equals,hashCode,toString) keep Object's implementation, as in translated classes. - A method overriding an inherited one with another erasure (
void accept(Item)forSink<Item>.accept(T)) gets the bridge a translated Java class would have, so calls through either C++ signature reach the one mock. make testsbuilds the files inUSER_TEST_SRCS(intest/) into the GoogleTest binary, with-Imock, and links gMock (pkg-config gmock, or setGMOCK_CFLAGSandGMOCK_LIBS) and GoogleTest. Without--runtime, link a C++ implementation of the runtime hooks withTEST_LDLIBS, as for--tests.
What gMock cannot express stops the translation (--check --mocks lists
it) as J2C-MOCK-UNSUPPORTED: a method with more than 15 parameters, the
most MOCK_METHOD takes, and a method inherited with erased return types
that no single C++ override accepts, such as Number and Comparable for
a value() that returns Integer in Java (declare it in the interface).
npm run mocks:gtest in vscode/ builds and runs the repository's own
example, test/cpp/Java17MocksTest.cpp, and compiles every mock generated
from test/src.
Using J2C with AI agents
j2c mcp serves J2C as a Model Context Protocol server, so agents such as
GitHub Copilot agent mode, Claude Code and Claude Desktop can check, fix,
translate and explain problems through typed tools. The VS Code extension registers it
automatically for each workspace folder. For Claude Code:
claude mcp add j2c -- java -jar /path/to/j2c-cli.jar mcp --root .
The tools are j2c_check, j2c_fix, j2c_report, j2c_translate,
j2c_build, j2c_test, j2c_run, j2c_explain and j2c_capabilities; the server also has the prompts
j2c-migrate and j2c-assess, and resources for the problem catalog, the
runtime's contract and translated files.
The server keeps check results between calls, so checking again after an
edit compiles only the changed files and the files that use them, with the
same result as a fresh check (--check-cache <files> bounds what is kept;
0 turns it off). Tool calls report progress to clients that ask for it,
can be cancelled, and ping is answered while one runs.
See docs/AGENTS.md for setup in each client, the tool reference, and the recommended workflow. A ready-made Claude Code skill, a Claude Code plugin with the skill and the server, Copilot instructions and a configuration for Copilot's cloud coding agent are included.
VS Code extension
The extension provides J2C: Translate to C++ from Java editor and Explorer
context menus. Select a Java file or source folder, then choose an existing
output directory. Problems appear in the Problems panel, and those with a
mechanical fix offer it as a quick fix. J2C: Build Translated C++ runs
make in an output directory and shows the compiler's errors in the
Problems panel, at their Java lines when j2c.lineDirectives is on.
The Marketplace release is not published yet. To install a locally packaged VSIX after building it:
code --install-extension <packaged-extension.vsix>
The extension invokes the bundled CLI and therefore requires Java 11 or newer. To prepare the extension and its bundled CLI locally:
cd vscode
npm run vscode:prepublish
This builds and stages the CLI JAR in the extension directory. Package the
extension with the VS Code Marketplace packaging tool (vsce) before
installing the VSIX.
Configuration:
| Setting | Default | Purpose |
|---|---|---|
j2c.sourcePaths |
[] |
Java source roots; defaults to java.project.sourcePaths, then conventional src folders. |
j2c.classPath |
[] |
Dependency JARs or class directories. |
j2c.cliJar |
"" |
Optional path to a custom CLI JAR; otherwise the packaged CLI is used. |
j2c.javaExecutable |
"java" |
Java executable used to run the CLI. |
j2c.sealedTypes |
"advisory" |
advisory emits ordinary inheritance and permits comments; reject rejects sealed and non-sealed declarations. |
j2c.runtime |
"bundled" |
bundled translates against the J2C runtime shipped in the extension, so programs run (JDK classes it lacks are compile errors); none translates against the JDK with stubs, the CLI's default; or a runtime directory. |
j2c.lineDirectives |
false |
Add #line directives, so compiler errors and debuggers refer to Java lines. |
j2c.build.make, j2c.build.wsl, j2c.build.wslDistribution |
"", "auto", "" |
How J2C: Build Translated C++ runs make (in WSL on Windows when make is missing). |
j2c.project |
"auto" |
auto uses a Maven or Gradle build in the workspace folder for source roots and the dependency class path (see Maven and Gradle projects); none turns this off. |
J2C Java to C++ MCP 질문
J2C Java to C++ MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add j2cpp -- npx -y @juangp3/j2c-mcp를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
J2C Java to C++ MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
J2C가 변환 문제를 자동으로 수정할 수 있나요?
네, j2c fix 명령어를 통해 익명 람다의 'this' 참조와 같은 특정 문제에 대해 Java 소스 코드에 기계적인 수정을 적용할 수 있습니다.
J2C는 Maven 및 Gradle 프로젝트를 지원하나요?
네, pom.xml 또는 build.gradle 파일이 포함된 프로젝트 디렉토리를 전달하면 J2C가 빌드 정보를 바탕으로 환경을 자동으로 설정합니다.
J2C는 완전한 Java 컴파일러인가요?
아니요, J2C는 소스 변환 도구이며 완전한 Java 런타임이나 컴파일러 기능을 제공하지는 않습니다.